Skip Navigation

[Resolved] Show Term Field from assigned taxonomy using a Content Template in a View

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

Problem:

The issue here is that the user wanted to show their taxonomy term fields.

Solution:

To do this I would recommend having a look at the link below.
https://toolset.com/forums/topic/show-term-field-from-assigned-taxonomy-using-a-content-template-in-a-view/#post-1205604

This support ticket is created 5 years, 9 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
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 4 replies, has 2 voices.

Last updated by Ben 5 years, 8 months ago.

Assisted by: Shane.

Author
Posts
#1204580

Ben

I am aware that I can use [types termmeta='slug'][/types] on a CPT to insert fields from the taxonomy the CPT is assigned to.

I want to use this sort of thing but adapt it for results in a View loop but using a Content Template. Is this possible?

For example, I want to have this shortcode somewhere in the CT which is then used in a View which displays CPTs. For every result in the View I want to be able to show a certain field from a specific taxonomy which the CPT would be assigned to.

I hope this makes sense. If you need any clarification then please let me know.

#1204761

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Ben,

This is possible to do only if the view that you are using it in is a taxonomy view.

If the view is set to list just taxonomies then you are able to list out any of the fields that are on that particular taxonomy.

Please let me know the type of view and we can go from there and provide more setup information.

Thanks,
Shane

#1205007

Ben

Thanks for your reply Shane!

So this would be impossible to do if the view I was using was a post types view?

I would like to be able to use it in the follow scenario:

A View showing custom posts, this view shows various different results over various custom post types. For each result, it displays information including which taxonomies the result is assigned to, it also shows a term field from the assigned taxonomy.

Is this possible?

#1205604

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Ben,

"So this would be impossible to do if the view I was using was a post types view?"
Yes if it was a post view it wouldn't be possible since the post view wouldn't be looping through taxonomy data.

Now what you can do is if you have a view listing out post, you can create another view that lists out the taxonomies and nest them.

So how it would work is like this.

Post A
- Tax1
--cust field
- Tax2
--cust field

Post B
- Tax3
--cust field
- Tax4
--cust field

Here is how you are able to do this. Take a look at this similar setup below.
https://toolset.com/documentation/user-guides/using-a-child-view-in-a-taxonomy-view-layout/#taxonomy-view-within-taxonomy-view

So instead of 2 taxonomies you will need to have 1 post view and 1 taxonomy view. In the taxonomy view you will add a query filter for "Taxonomy Term " then select "Set by the current post".

Then add that view into the Post View.

Please let me know if this helps.
Thanks,
Shane

#1209380

Ben

Perfect Shane! Thank you very much for your help with this.