• Resolved screenbeetle

    (@screenbeetle)


    I’m having doubts about the logic of a website I’m trying to set up. It needs to display two levels of categories before getting to the posts i.e parent cats ->child cat->posts. What I currently have is:

    Level one – List of Parent Categories: I have a page template using get_categories() to loop through a show all parent categories. I have a representative photo for each category using a plugin so it looks all pretty

    Level two – List of Child Categories: This I am using the category.php file in the theme as part of the template hierarchy. This again shows child cats using get_categories()

    Level three – List of articles in the child category: This is where I am stuck. I think I should now be using category.php to show the posts but I have already used that above. Happy to change but then how should I handle level two?

    Any help would be much appreciated.

Viewing 1 replies (of 1 total)
  • Thread Starter screenbeetle

    (@screenbeetle)

    Possibly a stupid question.

    With conditions the category.php file can of course handle all levels of categories.

    Level 2 (handled in category.php) – If parent cat is 0 – top level cat – then just display child cats

    Level 3 (handled in category.php) – If parent cat is not 0 – NOT a top level cat – then display posts

    Hope this helps someone

Viewing 1 replies (of 1 total)
  • The topic ‘A good way to set up a nested category structure’ is closed to new replies.