3

I have a two taxonomy vocabulary labeled as "Region and Category". Also made this as entity reference to a custom content type.

Now, I created a view of contents of "Business Page" and I want to create a contextual filter by taxonomy term, both Region and Category.

Temporarily, what I did is just focus on one taxonomy, by Region, to test if it works.

Please see images below for my configuration:

enter image description here

enter image description here

And this is the result:

enter image description here

My problem it is only working on term ID and not term Name.

I want to input the term Name and result would display on the page.

PS: I have a Pathauto enabled and added URL aliases to each terms.

2 Answers 2

2

I found this simple answer: How to use use Term:Name as a contextual filter

1
  • I try it, but didnt work. Right now I have view of the content type, and a relationship with the taxonomy term. I can add any field from the taxonomy, but can not include the relationship in the contextual filter.
    – ValRob
    Oct 29, 2018 at 18:13
1

I'll try to explain better Johnn's answer and relative link.

  1. add a relation to your View. Something like Taxonomy term referenced by field_my_taxonomy (you may want to make this required)
  2. add a Contextual Filter to Name (Taxonomy term). Check Relationship is set to your taxonomy reference field (field_my_taxonomy in my example)
  3. the key setting is: When the filter is NOT in the URL: Raw values extracted from URL, select position by your pattern and check "Use path alias"

You may want to specify the evalutation method Taxonomy term NAME (not ID), selecting the vocabulary.

If term names can contain spaces you should check the option to transform them in "-" and for pretty looking titles you can use the "Uppercase/Lowercase" thing.

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.