10

I need to generate a menu for parent taxonomy terms.

How would I go about doing this? I'm also looking to generate these terms in a block.

I have a views set up right now that displays just all taxonomy terms. I can't figure out how to filter out child terms. Is there a filter for this, or do I just have to manually create each category item?

2 Answers 2

19

In Drupal 7 to only show parent terms you add a “Contextual Filter” and add “Taxonomy term: Parent term,” then set “Provide default value” to a “fixed value” of 0.

That will filter out the child terms.

0
8

You can just add a normal filter, set the "Parent term" filter to "0", that does the same as the contextual filter with "provide default value" as mentioned above. Turns out the root terms have a parent of 0 which I only just found out thanks to this post :)

1
  • Both have the same outcome, this is much quicker.
    – Paul
    Commented Jan 28, 2015 at 16: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.