Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $parentCatName = single_cat_title('',false);
- $parentCatID = get_cat_ID($parentCatName);
- $top_cat = get_category($parentCatID);
- $childCats = get_categories( 'child_of='.$parentCatID );
- $childCats = array_merge(array($top_cat), $childCats);
- if(is_array($childCats)):
- foreach($childCats as $child){ ?>
- <h2><?php echo $child->name; ?></h2>
- <?php query_posts('cat='.$child->term_id);
- while(have_posts()): the_post(); $do_not_duplicate = $post->ID; ?>
- <!-- POST CODE -->
- <!-- END POST CODE -->
- <?php
- endwhile;
- wp_reset_query();
- }
- endif;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement