WordPress.org

Ready to get started?Download WordPress

Forums

Display children of parent category -- post titles ? (2 posts)

  1. jaketone
    Member
    Posted 6 years ago #

    Is there a way I can take all the subcategories of parent category 4, and display them like this.

    Sub Category Name
    Post Title
    Post Title 2
    etc

    Sub Category Name2
    Post Title
    Post Title 2
    etc

    Sub Category Name3
    Post Title
    Post Title 2
    etc

    It seems like it's possible to show the subcategories titles and descriptions but not individual post titles under each subcategory. Or does someone know how?

  2. jaketone
    Member
    Posted 6 years ago #

    Ok i may have come up with a solution.

    $categories = get_categories("title_li=&orderby=name&hide_empty=1&child_of=4");
    foreach ((array) $categories as $cat)
    {
         query_posts('cat='.$cat->cat_ID.'');
         while (have_posts()) : the_post();
              echo $the_title
         endwhile;
    }

    it worked but is it too excessive?

Topic Closed

This topic has been closed to new replies.

About this Topic