dynamic list of subcategories and posts (3 posts)

  1. stinker
    Posted 9 years ago #

    In my category pages, I want to have a list with both subcategories and their respective posts. The catch here is that I will be adding many new subcategories to this list and I don't want to add a new parameter to the category template each time I add a subcategory. In addition, my posts are in multiple categories, although that shouldn't make a difference.

    To visualize...

    Subcategory A
    -- Post 1
    -- Post 2

    Subcategory B
    -- Post 2
    -- Post 3

    Subcategory C
    -- Post 4
    -- Post 5

    It is easy to create lists of subcategories using "list_cats" and "wp_list_cats". And it is easy to list posts in a category using "get_posts". But it seems hard to do both at the same time. Of course, maybe that is because I suck at writing code for the loop.

    In many ways, what I am asking for is like a site map. But instead of listing all categories, I want to limit the list to those subcategories and posts in a specific parent category (or in this case, a parent subcategory).

    Any help is GREATLY appreciated.

  2. gixbecks
    Posted 9 years ago #

    ohhh i was asking something that seems you are saying you know how to do it??

    can you teach me how? thank you~!!

  3. stinker
    Posted 9 years ago #

    gixbecks... it isn't clear what you are asking. i will respond on the other thread.

    What I am specifically looking for is a LOOP that will do both of these...

    1. Get all child categories of a specific parent.

    2. For each child category, list all posts.

    See first post for example of how it will look.

Topic Closed

This topic has been closed to new replies.

About this Topic