WordPress.org

Ready to get started?Download WordPress

Forums

Dynamic Category Query Troubleshooting (2 posts)

  1. dtrickky
    Member
    Posted 2 years ago #

    Hello there,

    Here is my situation:

    I'm attempting to develop a theme with several levels of categories:
    -Services
    -Support
    -Training
    -Lesson A
    -Lesson B
    etc, etc, etc.

    I'm attempting to create separate category pages for each parent, child, and grandchild categories. To do this, I have a basic category.php file with if statements to include different templates depending on the hierarchy.

    For the services level, I'm running a loop of recent posts and a get_categories function to display all the first child categories of the services. This allows the user to click on one of the categories, in this case, "Training," and is taken to a separate category archive. My problem is coming on this level.

    I'd like the Training page to list the most recent post of each child category. So for instance, the Training page would have a list of the last post filed under its child categories of Lesson A & Lesson B.

    I would like to write the code so that in the future if a Lesson C is added, WordPress would dynamically update and list the most recent post of Lesson C.

    I appreciate any thoughts and time spent on this issue, I'm struggling to find a good solution.

  2. dtrickky
    Member
    Posted 2 years ago #

    Categories should be like this:

    -Services
    ---Support
    ---Training
    ------Lesson A
    ------Lesson B

Topic Closed

This topic has been closed to new replies.

About this Topic