• How to only show parent categories in sidebar?

    But also when browsing posts, to show all the subcategories of the parent category the current post is in, showing the hierarchy. the other parent categories will also be displayed, but only the one that the post is in will reveal the subcategories.

    So basically show the subcategories of a parent category only when viewing a post in that parent category.

    thanks

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

    (@dreamsoft)

    example:

    on single.php
    for example, if there are 3 parent categories, with subcategories:
    
    Fruits (parent)
     Apples
     Plums
    Veggies (parent)
     Tomatoes
     Onions
    Nuts (parent)
     Peanuts
     Almonds
    
    if the post is in subcategory Apples, the sibear should show:
    
    Fruits
     Apples
     Plums
    Veggies
    Nuts 
    
    if the post is in subcategory Almonds, the sibear should show:
    
    Fruits
    Veggies
    Nuts
     Peanuts
     Almonds
    
    on anything else (index, category pages) sidebar should only show parent categories, no subcategory.

Viewing 1 replies (of 1 total)
  • The topic ‘How to only show parent categories in sidebar’ is closed to new replies.