Skip Navigation

[Resolved] Point taxonomy link to a different URL then the taxonomy archive

This thread is resolved. Here is a description of the problem and solution.

Problem: I would like to include a list of terms associated with the current post, but I would like the links for each term to point to a custom URL. The links provided by the wpv-post-taxonomy shortcode point to the term archive pages, but I want to point to a custom URL generated with the term slug.

Solution: The best way to do this is to create a second View. It should be a taxonomy View of the cm-shop-category taxonomy, filtered by term, where the term is set by the current post. Then in the Loop Output editor, build your HTML link tag like this:

<a href="/shop-directory/?wpv-cm-shop-category=[wpv-taxonomy-slug]">[wpv-taxonomy-title]</a>

Insert this View in the Product Content Template or Template Layout to see the list of links appear on the Product page.

Relevant Documentation: https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-taxonomy-slug

This support ticket is created 5 years, 11 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 2 replies, has 2 voices.

Last updated by peterS-14 5 years, 11 months ago.

Assisted by: Christian Cox.

Author
Posts
#693842

Hi Toolset Team

I got stuck when i tried to do the following and wonder if I'm doing something wrong:

In a view for a product, I want to list the categories(taxonomies) the product is associated with it with link to page where that category is displayed, which is not a category archive.

When creating the view and select the taxonomy I tried the following:
- I selected the option term name
- used the link option in the content template editor, added the URL with the following parameters to it:
/shop-directory/?wpv-cm-shop-category=[wpv-post-taxonomy type="cm-shop-category" format="slug"]

Which lists the taxonomy names correctly but creates the URL without the taxonomy slug.

Now I wonder how this could be achieved in views?

Any hint is very welcome

#694437

It sounds like you want to create a list of terms related to this product, and link those terms to custom URLs. The best way to do this is to create a seconnd View. It should be a taxonomy View of the cm-shop-category taxonomy, filtered by term, where the term is set by the current post. Then in the Loop Output editor, build your HTML link tag like this:

<a href="/shop-directory/?wpv-cm-shop-category=[wpv-taxonomy-slug]">[wpv-taxonomy-title]</a>

Insert this View in the Product Content Template or Template Layout to see the list of links appear on the Product page.

We have more information about this shortcode here:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-taxonomy-slug

#694709

Hi Christian

thanks for your fast reply and the provided solution 🙂

It works perfectly and is exactly what I was looking for.

Best regards and thanks again, Peter

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.