Hello everybody,
I am setting up a image gallery with cck, imagecache, views and taxonomy. I have two layers of the album before the image is shown. Like that:
Year -> Event name -> Picture
To the image nodes there are taxonomy terms attached. Both terms, "year" and "event name" are from the same vocabulary but on different levels.
How can I filter in my view for the terms of the top taxonomy level? If I filter for the vocabulary, obviously all the terms are shown, but I just want the top level ones ("year").

I would be glad if someone has a nice idea!
Thank you very much, Simmel

Comments

Thithi32’s picture

+1
Did you find anything?

ybresson’s picture

If you want to display the top-level terms of a given vocabulary, create a "term" view ("View type: Term") with these basic settings: a field for "Taxonomy:Term", an argument for "Taxonomy: Vocabulary ID"

Then to filter:
1) add a relationship to "Taxonomy: Parent term"
2) add a filter on "Taxonomy: Term ID", using relationship "Parent", with operator set to "Is empty (NULL)"

This will list only top-level terms for the given vocabulary.

jct’s picture

Excellent explanation. I will mention taxonomy hierarchy, in case it might help other's Google searches.

hunginf’s picture

Thank so much ! :D

Anonymous’s picture

Thanks ... very helpful !

jeeba’s picture

Thantls, the answer was amazing!, three years later it stills rulez :D

mcdoolz’s picture

Filter > Parent term >is equal to

Leave it blank.

Walla.

-
Be the occasion.

maxplus’s picture

Thanks @ mcdoolz
your simple solution is working for me.
Also a little cleaner than the solution of ybresson because you don't need a relationship

mahmoudsayed96’s picture

Thanks this working fine with me

marty.true’s picture

I just tried this exact setup and it still shows every term that is a "parent".
So if I have "County -> City -> Neighborhood" hierarchy, then the view settings above will show both "County" and "City" because they are both technically "parents".
Still looking for a solid setup to get only the top level parent term to show (with count).