5

i have a vocabulary that contain plus of 5 level descendant, i need to create the view to display the first 2 levels and grouping by the first one, i do this:

  1. FIELDS: (Parent) Taxonomy term: Name - Taxonomy term: Name
  2. FILTER CRITERIA: Taxonomy vocabulary: Machine name (= All Type Announce)
  3. SORT CRITERIA: (Parent) Taxonomy term: Weight (asc)
  4. RELATIONSHIPS: Taxonomy term: Parent term

and i get all list of taxonomy for this vocabulary grouping by parents, how to set only 2 levels?

2 Answers 2

1

It's simple. In fact, there is no need to add any relationship in the Views. Just create the taxonomy term view and add a filter criteria of Taxonomy term: Parent term. (see screenshot) Then set the value to be equal to ''. This will fetch you all the parent terms as they don't have any parent! ('') See the last link

1
  • Thank you for your answer. I think that this would really help. It would help to be more descriptive with answers rather than pasting a screenshot because images are not accessible for everyone. A detailed list of steps would help compliment your answers in the future.
    – mradcliffe
    Commented Nov 12, 2019 at 14:39
0

You should be just fine by introducing 2 chained parent relationships. Setting the criterion where parent of the parent is NULL should work. Well, this is a purely UI way of doing that, which is a pro. The con is that queries with nested relations might become heavy at some point, therefore consider turning on Views cache when you deploy the site.

1
  • "Artur's" method is pretty good. The only thig what I want to say is that "Setting the criterion where parent of the parent is NULL" need to be "equal to 0 (zero)". Also to get it work I had to group terms by parent. Commented Jun 24, 2013 at 18:44

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