Hoping there is a guru who could tweak this code or provide something new.
I need to break down and list all posts in a category AND it's subcategories. The following code only lists posts in the sub cats, so any post in the main category is skipped. So close though. Help?
[please mark your code using the 'code' button or backticks;
next time, please, for any code of more then 10 lines, use the pastebin]
<?php
$parentCatName = single_cat_title('',false);
$parentCatID = get_cat_ID($parentCatName);
$childCats = get_categories( 'child_of='.$parentCatID );
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;
?>