2

In the Views UI I set up the Relationship "Taxonomy:Parent term" and then a Field "Taxonomy: Term" with that relationship.
But the problem is that It displays the parent terms of all the vocabularies (I have several vocabularies). I also tried the Field "Taxnomy:All terms" as it can limit the terms by vocabularies but it can't have the Relationship "Taxonomy:Parent term"

Is there any way to display only the parent terms of one certain vocabulary for hierarchical taxonomy in a view field?

1
  • version of drupal? please edit your tags. will help everyone.
    – jan
    Jan 19, 2012 at 3:50

2 Answers 2

3

I think my answer to a similar question would be useful:

I believe that your problem would be solved by adding a relationship to your view. Here are the steps:

  1. Add Relationship: taxonomy terms on node
  2. Select the vocabulary you want to use.
  3. Add Relationship: parent term

Now you should be able to add fields from any of the terms or their parents, and to use them as contextual filters as well.

Note that this is for Drupal 7

1
  • 1
    Thanks. I didn't know I can do this without much effort in Views instead of coding to get the term's parent. Thanks.
    – Adamtan
    May 20, 2015 at 13:01
1

have you tried filters? As far as drupal 6 is concerned, filters by taxonomy term can let you choose from which vocab you only want to show. With drupal 7 it would be the same. I'm not on my dev server right now but you can check filters.

1
  • Sorry I forgot to mention that it's about a field of "node views" but not "taxonomy views". If set a filter for a vocabulary I think it just filters nodes tagged with the vocabulary. What I need to do is to have a field (of node views) that displays the parent term of certain vocabulary. BTW I'm on drupal 6
    – chinita7
    Jan 24, 2012 at 18:41

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.