Skip Navigation

[Resolved] Hierarchical taxonomy terms in views

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

Tagged: 

This topic contains 5 replies, has 2 voices.

Last updated by Brown 8 years, 2 months ago.

Assisted by: Shane.

Author
Posts
#362065

I am using a hierarchical taxonomy ("destination") for :
Continent
- Country
-- City

In my View, if I use the shortcode: [wpv-post-taxonomy type="destination" format="name"] it shows the full tree:
"Europe, France, Paris"

However, I would like to display only the country or only the city, such as "France" or "Paris"
So how can I display a single taxonomy term?

#362186

Shane
Supporter

Languages: English (English )

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

Hi Brown,

Thank you for contacting our support forum.

In order to achieve this you will need to use the View in a View setup.

We have a small tutorial on this that should be able to guide you through this.
https://toolset.com/documentation/user-guides/using-a-child-view-in-a-taxonomy-view-layout/

Just have a look at the section that says "Taxonomy View with a Taxonomy View for a Child"

Please let me know if this helps.

Thanks,
Shane

#362214

Thanks Shane.

That seems extremely over-complicated. Can it not be achieved via php "get_terms" or something?

#362288

Just to clarify, I do not need to display links to the taxonomy, merely the text.

#362507

Shane
Supporter

Languages: English (English )

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

Hi Brown,

Yes this would be a good idea to use the get_terms but we will run into an issue with using this method.

The problem would be that in order for us to get the correct information to be display we must first need to know the the taxonomy slug which we can simply provide in a 1 instance that would return all the terms of that current post, but when it comes to the child terms we will need to specify the parent's one by one in order to get the children of that current taxonomy term.

We do not have a shortcode to return only one parent term, instead our shortcode returns all the terms that have been attached to the post.

So the simplest way of doing this is using the nested view as it is able to do exactly what you want 🙂 just that it may look over complicated.

I will be more than happy to help you with this setup if you like 🙂

Thanks,
Shane

#366197

Got it done with get_the_terms.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.