Skip Navigation

[Resolved] Displaying taxonomy hierarchies with hierarchy structure

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

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 3 replies, has 3 voices.

Last updated by Luo Yang 2 years, 12 months ago.

Assisted by: Luo Yang.

Author
Posts
#2354801

Tell us what you are trying to do?
Displaying taxonomy hierarchies with hierarchy structure: On product page I want to list our Vehicles-taxonomy and it's Make/Model/Year hierarchy for which the product in question applies to.

Is there any documentation that you are following?
I've tried all the examples/tickets I've found within the site, but it seems some of them are outdated, for example pls check the images here, I can't even find those options: https://toolset.com/documentation/legacy-features/views-plugin/using-a-child-view-in-a-taxonomy-view-layout/

Is there a similar example that we can see?

What is the link to your site?
hidden link

#2355223

Nigel
Supporter

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

Timezone: Europe/London (GMT+01:00)

Screenshot 2022-05-04 at 11.09.09.png

You have a Vehicles taxonomy, and it's a hierarchical taxonomy where the top-level refers to make, the next level model, and the 3rd level year, right?

How much control do you need over how this is output?

If you have a product with, say, the vehicle terms VW, Golf, and 2019 applied, then simply using the Single Field block to output the terms would produce

VW, Gold, 2019

i.e. it is produced as a comma-separated list.

You have more control with the old shortcode method to output the terms, because you can specify the separator, e.g. you could output them like

VW >> Golf >> 2019.

If something like that would work then you should use the Fields and Text block, switch it to HTML mode, then use the little Toolset icon (screenshot) to insert the required shortcode (choose your Vehicle taxonomy, and in the resulting pop-up you'll see an option for the separator, which you can set to what you want).

You'll see that inserts a shortcode in the editor, e.g.

[wpv-post-taxonomy type="vehicle" format="name" separator=" >> "]

You can be a little more creative so that you output the terms as li items of a ul, for example, with

<ul>
<li>[wpv-post-taxonomy type="colour" format="name" separator="</li><li>"]</li>
</ul>

You would only need to consider nested Views (which can only be added with the legacy editor) if you wanted to use different separators between the different hierarchy levels, or to output something like Ford Focus (2019).

#2355601
Screenshot 2022-05-04 103542.png

Hi Nigel,

thank you for your reply, I appreciate it. However, this doesn't resolve my issue which is to show the results hierarchy (see picture).
I was able to generate all the taxonomies but not so it would make sense, for example:

Audi
A3
2014
2016
A5
2015

etc. I've tried to work with the Views, but since the documentary isn't providing me current info/pictures, I'm a bit lost on that...

#2355899
parent-tax-view-filters.jpg

Hello,

It is possible with nested taxonomy views, and you need to setup those views with legacy editor. For example:
1) Parent taxonomy view:
- Query terms of taxonomy "Vehicles-taxonomy"
- Filter by:
a) Taxonomy is set by the current post
b) Select taxonomy terms whose parent is None.
- In view's loop, display term information + below child taxonomy view shortcode

See my screenshot

2) Child taxonomy view:
- Query terms of taxonomy "Vehicles-taxonomy"
- Filter by:
a) Taxonomy is set by the current post
b) Select taxonomy terms whose parent is the value set by the parent view.
- In view's loop, display term information + child taxonomy view shortcode itself

In the single Vehicle product page, display above Parent taxonomy view shortcode