Display list of Sub-Categories and the posts they contain, within one main Category

Question was answered on another site.. thank you!
BTW, the code that accomplished what I needed was:

$categories =  get_categories('child_of=31');  
foreach  ($categories as $category) {
    //Display the sub category information using $category values like $category->cat_name
    echo '<h2>'.$category->name.'</h2>';
    echo '<ul>';

    foreach (get_posts('cat=".$category->term_id) as $post) {
        setup_postdata( $post );
        echo "<li><a href="'.get_permalink($post->ID).'">'.get_the_title().'</a></li>';   
    }  
    echo '</ul>';
}

Leave a Comment