I have taxonomy vocabulary called “Groups”, with 3 terms. I have two content types that both use a Groups term reference field. These content types are called “Media” and “Links”.

When displaying “Media” (node), I have an embedded view that shows “Links”. How can I only show “Links” that have the same terms as the actual “Media”?

Is it possible to do with contextual filters?

  • you need to add relation between to types. – monymirza Nov 8 '12 at 10:47
  • 1
    @monymirza You don't. Would you mind telliing us how adding a (views) relationship helps in this case exactly ? – AyeshK Nov 8 '12 at 15:02

I have embed view that shows “Links”. How can I only show “Links” that have the same terms as the actual “Media”?

I'm not sure you used Entity Views Attach module to attach the View or just placing the View as a block.

Whatever it is, you can do it. But if you have EVA, you will be able to set the current node ID argument easily.

  1. Add a new View as Show: Content, Of Type links. Continue and Edit.

  2. Then, in the Views UI, you will see a filter to show only Link nodes are added. Now, add extra fields you want from the Link nodes.

  3. Set configuration as marked in the image below.

  4. Save the View.

  5. Save the View and enjoy!

    • if you have EVA module, do not set to inherit node ID to the View (it will give wrong results). Send the term ID as argument(s) if possible.

enter image description here

| improve this answer | |

Yes, you can do this using contextual filters. You need to add a "Content has taxonomy term ID" contextual filter, and set the default value to "Taxonomy term ID from URL" and check "Load default filter from node page, that's good for related taxonomy blocks". now check "Limit terms by vocabulary" and select "Groups" vocabulary.

| improve this answer | |

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.