I have two views, first one is block, second one is page. I have vocabulary, let's call it "food". In the food vocabulary we have that hierarchy:

  • Fruit
    • Apple
    • Banana
  • Meat
    • Chicken
    • Pork

Both views goal is to show taxonomy terms, but first one shows ONLY parent terms, then we click on parent Fruit, we get second view, which shows ONLY terms from Fruit, so Apple and Banana. If we clicked on Meat term, we get terms Chicken and Pork. My question is how to do it?

1 Answer 1


You don't need two Views Display for that, you can do that one with one Page Display.

  1. Create Views of type Taxonomy term and add Page Display
  2. Add Filter for Food Vocabulary
  3. Add the Parent Relationship. It is called Taxonomy term but look at the Description The parent term of the term. This can produce ....

    If you Require it the results will only show terms that have Parent items, so you'll probably want that.

  4. Add Contextual filter Name from the Taxonomy term Category and configure it:
    Relationship: Parent
    When the filter value is NOT available
    Display a summary
    Format List
    Base path (you must enter the Page path if this isn't the first Page Display in your Views)
    Display record count with link
    When the filter value IS available or a default is provided
    Specify validation criteria
    Taxonomy term name
    Transform dashes in URL to spaces in term name filter values
    Transform spaces to dashes in URL

You will see a list of your parent items in the results (as a Summary), then when you click on one you will see Views results terms that are its children.

  • That is very helpful. I created one view with parents and childs as you mentioned and it's working. One last thing i need to do, i have problem with using Format: List, because i have custom format for it. Option list and unformatted discarding my custom format in template for this view. Commented Apr 21, 2019 at 14:16
  • I'm glad it's working! Can you share some more information about your custom Views format? This should go into a separate question. Try to answer: Can you see your custom formatter in Views when you want to change the Format? What template did you change?
    – prkos
    Commented Apr 21, 2019 at 17:01
  • I have html and php code in views-views-fields--templatename-display.tpl.php. So this view reads this file and shows to me food nodes. If I choose Format: List, it tells to view use list style instead of my template. Option unformatted gives me same result. Commented Apr 23, 2019 at 19:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.