Skip Navigation

[Resuelto] How to display term meta fields alongside the taxonomy terms of a post

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

Problem:
When displaying a post its taxonomy terms are listed. How to display term meta fields at the same time?

Solution:
Create a taxonomy View to query the terms belonging to the current post, and output the taxonomy term meta as well as the term name.

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

Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

Etiquetado: ,

Este tema contiene 2 respuestas, tiene 2 mensajes.

Última actualización por davidR-12 hace 6 años, 3 meses.

Asistido por: Nigel.

Autor
Mensajes
#1089293

I have a page here:

enlace oculto - Password: Europa-808

As you can see the category names under 'choose a module' are coloured. This is done using a color-picker added to the category and then inline CSS.

However, I cant think of a way to do this for the 3 products above it. These have a category term list using the following code:

[wpv-post-taxonomy type="download_category" format="name" separator=" / "]

As this displays all terms in a list, I dont have a way to add the color CSS to each. Is there a way to do this?

Regards,

David

#1089488

Nigel
Supporter

Idiomas: Inglés (English ) Español (Español )

Zona horaria: Europe/London (GMT+00:00)

Hi David

Rather than use the wpv-post-taxonomy shortcode, which will output the terms belonging to a post in a list, I think you need to create a taxonomy View where the terms will be output individually and where you can use the termmeta fields.

I assume you have a termmeta field with, for example, the hex code of the colour for that term.

So create a View to display those taxonomy terms which has a Query Filter to say the terms should be set by the current post, and in the Loop Output section output the term name wrapped in a span which has an inline style where you supply the colour from your term meta field (which you insert using the Fields and Views button).

#1091160

Hi Nigel,

Thanks for that. Works perfectly.

Regards,

David