Support » Themes and Templates » Show posts underneath each category in list_categories

  • I am creating a website that relies heavily on its Category organization. When clicking a category, I am trying to list its subcategories, and then the links underneath that heading for whichever category it is calling out.

    Please see list of categories here:
    I would like to have a list of all of the posts of each category under each title. I feel that this should be pretty easy, but my brain is hurting from thinking about it, so I figured I’d come ask here. I think I could easily do it manually, but I’d really like for it to update on its own whenever a new category is created (instead of having to go in and add the new category in the code and then call out the posts underneath that).

    If anyone has any advice it will be greatly appreciated. I’ve already spent so much time going back and forth with this!

    Thank you,

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


    Forum Moderator

    Off the top of my head, I’d probably use get_categories with the child_of parameter to grab all the child categories. Then loop through this list and perhaps use get_posts to list the individual posts.

    That said, there may be a more elegant way of achieving the same result.

    Did you ever get the code to make this work?
    I am interested in the same idea.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Show posts underneath each category in list_categories’ is closed to new replies.