Skip Navigation

[Resolved] How to display an specific value from Taxonomy(Array) using break line separator

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

Problem: I would like to loop over a set of taxonomy terms and display the value of a custom term field next to the term title.

Solution: Use a View of the taxonomy and insert the wpv-taxonomy-title shortcode to display the title. Use the Types field shortcode to display the custom field value.

<wpv-loop>
  [wpv-taxonomy-title] [types termmeta="your-field-slug"][/types] <br />
</wpv-loop>

Relevant Documentation:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-taxonomy-title
https://toolset.com/documentation/customizing-sites-using-php/functions/

This support ticket is created 5 years, 8 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.

Our next available supporter will start replying to tickets in about 0.19 hours from now. Thank you for your understanding.

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 Furlan 5 years, 8 months ago.

Assisted by: Christian Cox.

Author
Posts
#1210769

Hi,

I'm trying to read an specific value from an Taxonomy to be displayed in a View.

For instance, I've a taxonomy called Categories which has the following categories [category_1, category_2,...,category_n].
I want do display in a view, for example, category_name_4, category_name_5 and category_name_6 with their respectively values (and add break line at the end of each taxonomy value):
category_name_4 True
category_name_5 False
category_name_6 True

Anyone who knows how to do this?

Thanks.

#1210782

Hi, it sounds like you have created a custom field and applied it to terms in a taxonomy. You would like to display the taxonomy terms and their custom field values in a View of this taxonomy. Is that correct? If so, then you can use the Types field shortcode to display custom field values in the View's loop, and add a line break tag at the end of the line. Here's an example:

<wpv-loop>
  [wpv-taxonomy-title] [types termmeta="your-field-slug"][/types] <br />
</wpv-loop>

You can use the Fields and Views button above the Loop editor to insert this shortcode automatically, or you can write the code manually.

#1212073

My issue is resolved now. Thank you!