Skip Navigation

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

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

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 6 years, 2 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
- 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)

This topic contains 2 replies, has 2 voices.

Last updated by davidR-12 6 years, 2 months ago.

Assisted by: Nigel.

Author
Posts
#1089293

I have a page here:

hidden link - 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

Languages: English (English ) Spanish (Español )

Timezone: 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