dynamic list of subcategories and posts
-
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 2Subcategory B
— Post 2
— Post 3Subcategory C
— Post 4
— Post 5It 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.
- The topic ‘dynamic list of subcategories and posts’ is closed to new replies.