Support » Themes and Templates » dynamic list of subcategories and posts

  • stinker

    (@stinker)


    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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • gixbecks

    (@gixbecks)

    ohhh i was asking something that seems you are saying you know how to do it??
    http://wordpress.org/support/topic/94708?replies=1

    can you teach me how? thank you~!!

    stinker

    (@stinker)

    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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘dynamic list of subcategories and posts’ is closed to new replies.