0

There are many posts and tutorials for creating views with contextual filters to display content that shares the same taxonomy term, but my requirement is slightly different.

I want to create a view that displays content that is related to the content being viewed via taxonomy terms BUT I do not want the related content to be based on the SAME taxonomy term, but instead a related taxonomy term.

I think I need to create a term reference field on the actual term itself, so say its called 'Related Term', and in that field I reference the other term, so I have a relationship between the two terms.

The bit where I'm stuck is how then to create a view much like the contextual filter views that show content with the same term as the content being viewed, except it will instead show content of the related term referenced in the field described above.

The general idea is that if for example content with the term 'Car' is being viewed, that the view will list content with the term 'Car Accessories'.

Is this possible or is there a better way to approach this?

1
  • Yes, a term reference will help. But the specifics depend on how you have structured your content. In general, I would use Panels for this, because Panels will allow you to set contextual filters in Views using the UI, which makes this relatively straightforward to test and debug. Commented May 8, 2022 at 2:00

1 Answer 1

0

I solved this using Views Token Arguments - solution here:

https://www.drupal.org/forum/support/post-installation/2022-05-07/related-content-by-taxonomy-term-but-using-a-relationship-between-terms

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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