0

I'm trying to create a view for a taxonomy term and show a related content based on term name.

For example, i have term name Manchester United in vocabulary teams and i want to show all news nodes that have term Manchester United. The problem is that terms in news are in different vocabulary.

For now i create a View with Contextual filters Content: Has taxonomy term ID which get me ID for term Manchester United from vocabulary teams.

My questions is, how i can use this term name and show related nodes from news which have same term name but in different vocabulary and different ID.

EDIT: it's important to know that i'm getting first term by his ID in url.

2

1 Answer 1

0

First option (doesn't work as expected though):

You should be able to do that, by doing the following in your contextual filter:

  1. Check the "Specify validation criteria" option.
  2. Select "Taxonomy term" as "Validator".
  3. Select "Term name" as "Filter value type".

I just tried this however and it returns only one result, which is not what you need.

Alternative (this one was tested and works):

You can create a View of Taxonomy Terms, and then use a "Taxonomy term: Name" contextual filter. Afterwards, you can add a relationship to your tagged nodes, using the "Taxonomy term: Content with term" relationship.

That way, you can get all the content tagged with a specific term name, even if the term name belongs to different taxonomies.

Here is a sample View configuration:

enter image description here

and a sample result-set with "ManU" used as a contextual filter:

enter image description here

Good luck!

6
  • Thanks but your Alternative works only if only my contextual filter is term name. In my case i have term id in url. Commented Jan 5, 2017 at 14:14
  • Okay, will think of an alternative. In the meantime, please update your OP, the information about having a Term ID in the URL is important. Commented Jan 5, 2017 at 14:17
  • I don't know what OP is. You want me to edit my question ? Commented Jan 5, 2017 at 16:17
  • Yes, that's what I meant :-) OP => Original Post Commented Jan 5, 2017 at 16:22
  • Hello, after so long. Now i'm trying to do this related posts with term name, but in view when i type "manchester united" it works, and when i open taxonomy page it doesn't. Its because name in url is not "manchester unite" and is "manchester-united". Any suggestons ? Commented May 31, 2017 at 18:41

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.