4

I've been trying this for awhile, and I keep finding answers that are close - but not quite.

If there is a node with taxonomy terms attached to it, I want to create a block in Views that I can place in the sidebar that will load the terms that are attached to THAT node.

I want to do it through Views so I can rewrite the URL with a custom query using the term IDs.

I'm open to other suggestions as well! I've also tried Display Suite, but I didn't want to go too far down that path just yet. The attached image is ideal, where the category taxonomy terms are being loaded based on terms that are attached to the node.

Ideal Wireframe Example

  • 1
    Just remember ask yourself what you're querying. Views is just a mysql gui with too many buttons. :) – chrisjlee May 8 '13 at 22:41
  • 1
    Hah, yea. I find that turning the on the SQL queries helps me when debugging. – kyletaylored May 16 '13 at 20:33
11

Come on it's not that hard! I'm assuming you want to display all taxonomy terms across multiple taxonomy reference fields/vocabularies. You can however filter the list of taxonomy terms that the View returns using Vocabulary filters.

  1. Create a new view on Taxonomy table. You are basically showing taxonomy terms.
  2. In the View creation page, uncheck "create page" and check "Create block". Give it a title "Categories". Click "Continue and Edit".
  3. In the Views UI, add a new Relationship Taxonomy term: Content with term, and uncheck "require this relationship".
  4. Add a new Contextual filter : Content: Nid and choose the just-created relationship as the relationship, Provide default value > Content ID From URL under When the filter value is NOT available. Also add basic validation check to the contextual filter.

basic settings validation info

5 . Save the View and put the block where you want to display.

You can check the view by entering a test node ID to the preview field. It should show all taxonomy terms attached to THAT node.

  • 1
    Oh my god, wow. I seriously thought I tried that combination. I was getting into some seriously complex contextual filters and relationships. Thanks for the help! – kyletaylored Apr 10 '13 at 0:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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