Upgrade Your Drupal Skills
We trained 1,000+ Drupal Developers over the last decade.
See Advanced Courses NAH, I know EnoughShow Only Specific Levels of Taxonomy in Views
One OSTraining member asked us this question:
How can I set the filter criteria so that Views shows only the second level in of a taxonomy?
We've had that question from other members before, so here's a tutorial explaining how it's done.
First, you need a taxonomy that has parent and child terms, as in this example:
Let's show you how to set up Views so that only the child terms show: Amphibians, Birds, Fish, Mammmals, Reptiles.
- Go to Structure > Views > Add new view.
- Create a View that shows "Taxonomy terms".
- Click "Add" next to Filter Criteria.
- Search for "Taxonomy term: Parent term".
- Click "Apply (All displays)".
Now the "Value" in this next step the key to the process.
- The top level taxonomy terms have a value 0.
- The second level terms have a value of 1.
- The third level terms have a value of 2 etc.
This tutorial on Delta in Drupal explains more.
So if we want to ignore the parent terms, we choose "Is greater than or equal to" and then enter a "Value" of 1.
- Save the filter and save your view.
- You should now see that the parent terms are ignored:
About Drupal Sun
Drupal Sun is an Evolving Web project. It allows you to:
- Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
- Facet based on tags, author, or feed
- Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
- View the entire article text inline, or in the context of the site where it was created
See the blog post at Evolving Web