Saltar navegación

[Resuelto] Custom taxonomy term links with wpv-post-taxonomy

Este hilo está resuelto. Aquí tiene una descripción del problema y la solución.

Problem: I would like to list the taxonomy terms associated with a post, and format them as links. However, when I use the wpv-post-taxonomy shortcode to display links, the URLs point to the term archive. I would like to link to a custom post URL instead, where the post slug matches the term slug.

Solution: Assuming the Brand term slugs and their corresponding Tour Operator post slugs are identical, you can do this by replacing the wpv-post-taxonomy shortcode with a View of the Brand Taxonomy. Add a Query Filter, filtered by term, where the term is set by the current post in the loop. In the Loop Output of this View you can construct link tags using a combination of HTML and Views Shortcodes, like this:

<a href="/tour-operator/[wpv-taxonomy-slug]">[wpv-taxonomy-title]</a>

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

This support ticket is created hace 6 años, 8 meses. 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)

Este tema contiene 2 respuestas, tiene 2 mensajes.

Última actualización por Daniella hace 6 años, 8 meses.

Asistido por: Christian Cox.

Autor
Mensajes
#729654

Hi,
I have the following View on the homepage, enlace oculto
<div class="repost"><h3>[wpv-post-title]</h3>
<p>[wpv-post-taxonomy type="brand" separator=", " format="link" show="name" order="asc"]</p></div>

This is listing recent posts in a CPT called Repost that has a Brand Taxonomy. This taxonomy is listing the brand. However, this brand is also the same as a CPT called Tour Operator. What I would like to do is have the Brand link to the Tour Operator page. For example, on this link:
The Other Face of Molokai
UnCruise Adventures

Uncruise Adventures will link to enlace oculto NOT, enlace oculto as it is doing now.

How can I do this?
Thanks!

#730537

Hi, assuming the Brand term slugs and their corresponding Tour Operator post slugs are identical, you can do this by replacing the wpv-post-taxonomy shortcode with a View of the Brand Taxonomy. Add a Query Filter, filtered by term, where the term is set by the current post in the loop. In the Loop Output of this View you can construct link tags using a combination of HTML and Views Shortcodes, like this:

<a href="/tour-operator/[wpv-taxonomy-slug]">[wpv-taxonomy-title]</a>

We have some shortcode documentation available here for your reference:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-taxonomy-slug

#737631

Thank you so, so much!