2

I have a vocabulary with the following structure:

Vocabulary
Parent term 1
    Child term 1.1
        Node tagged with child term 1.1
    Child term 1.2
        Node tagged with child term 1.2
Parent term 2
    Child term 2.1
        Node tagged with child term 2.1
    Child term 2.2
        Node tagged with child term 2.2
Parent term 3 (no children)
    Node tagged with parent term 3
    Node tagged with parent term 3

With very limited knowledge I managed to create a view displaying the top-level terms. I would like to click on one of this terms and go to a page displaying either the child terms of the selected parent or, if there are no children, the nodes tagged with that term. After much trial and error all I get when clicking a parent term is a message of 'There is currently no content classified with this term' when I really want to display its children.

In a desperate attempt I created different vocabularies for the terms with child terms and the terms with just nodes underneath. Then I used Views to create different blocks based on the vocabulary name and placed those blocks using the Context module, but this seems like a long shot and I'm sure there's a more straightforward way to accomplish this. By now I have tried several combinations with Taxonomy Menu, Taxonomy Display, arguments and relationships in Views, etc. and I'm not any nearer.

I posted this at the Drupal forums but with no luck yet, I hope someone here can help me figure this out :)

1 Answer 1

0

Follow these steps

  1. Create a view
  2. Add a relationship "Content: Tags", (Tags is vocabulary name I want to show content for)
  3. Add a contextual filter "Content: Has taxonomy term ID (with depth)" (you can provide a depth of taxonomy term here to display content, if set to 0 it will show content tagged with that particular term id only, if 1 then that particular term id + its first child term content)
  4. And provide proper value for this contextual filter.

Here is the screenshot of view I've created: snap

Hope this helps.

Your Answer

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

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