Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Put this in your template file
- $category_ids = get_all_category_ids();
- foreach( $category_ids as $cat_id ) {
- echo category_description( $cat_id );
- list_cat_posts( $cat_id );
- }
- // Put this in your functions.php
- function list_cat_posts( $category_id ) {
- $args = array(
- 'category__in' => $category_id,
- 'posts_per_page' => -1
- );
- $cat_query = new WP_Query( $args );
- if( $cat_query->have_posts() ) {
- while( $cat_query->have_posts() ) {
- $cat_query->the_post();
- // Output each post in the category here using standard template tags
- echo '<h6><a href="">' . get_the_title() . '</a></h6>';
- }
- }
- wp_reset_query();
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement