1

I created a view listing all parent terms and child terms in my site. Following those suggestions: Tiered HTML lists using Views and Taxonomy?

Now, I need to make the list of child terms change automatically according to the parent term page. For example: In the parent term page: Fruits, This view will show a only a list of those terms:

  • Bananas Apple ….

In the parent term page: Colors, This view will show only a list of Colors child terms:

  • Red Green Yellow

Any Idea how to do this?

2 Answers 2

6

In Drupal 7, I accomplished this by creating a view (for a block) that uses the contextual filter, "Taxonomy term: Parent term" - Under "When the Filter is Not Available" choose "Provide default value", then select "Taxonomy term ID from URL", and check "Load default filter from term page". I then displayed the block on the taxonomy pages where I want the child term lists to appear.

I'm just starting to work with Drupal and I suspect that there's a more robust solution - this works with pathauto but has trouble with terms that use a URL alias - but the instructions I've found for other approaches either don't work or require considerable coding. If you devise a better way, or somebody else has ideas, I'm all ears.

3
  • Thank Aaron, I'm using now Taxonomy menu, and Block menu to accomplish this, However, I will try your method.
    – Nizarnav
    Commented Mar 2, 2012 at 21:20
  • I had an issue with this method, once you select for example : apple. the views Fruit is not any more visible. I want the views fruit to show always when selecting any of its terms.
    – Nizarnav
    Commented Mar 10, 2012 at 19:25
  • This is a great way to do it! (especially considering View will be apart of the Drupal 8 core)
    – ak112358
    Commented Nov 14, 2014 at 19:33
0

I found a solution to accomplish this, without using views.

  1. I have used Taxonomy menu to display a list of all my terms.
  2. Then, I used a nice module called: Menu block , to achieve exactly what I want. It can display a list of parent terms, and then display the second level of terms or deeper when you visit one of the parent terms page.

Hope this can help someone.

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.