Skip Navigation

[Resolved] Display Taxonomy Terms Hierarchically

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

Problem:
How can we create a list of Taxonomy Terms that are respecting the hierarchy of the terms as set in the backend?

Solution:
You can create a Parent View displaying all Terms without a parent - then as many Views as you have hierarchical layers
So if you have 2 more child terms (maximally) for each parent you'd add 2 more Views, each time querying the Terms that have as parent Term the one set in the "View where this View is inserted"
Then, insert each view into each other, so the Parent View holds a shortcode calling the next child view and that view loop, in turn, has a shortcode to another term child view, and so on.

Then you can insert the Parent View in a page and will see all terms output in the hierarchically correct order.

This support ticket is created 4 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
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 20 replies, has 2 voices.

Last updated by Jim 4 years, 8 months ago.

Assisted by: Beda.

Author
Posts
#1520637

Can you provide me access to this View(s) and a link where it's built, so I can quickly check?

#1521369

Jim

Can you get in Beda?

#1522287

That is not an archive, the 3 links are all Views, one lists posts, the other 2 the taxonomy terms

You use it here hidden link and here hidden link
I see the taxonomy terms there, separated by a comma, like
Projecten , Hotels

You need to separate the most child item, as trailing comma.
You can control the last item with [wpv-item index=last ] so to not output a comma.
See more details on this shortcode here https://toolset.com/documentation/user-guides/views/views-shortcodes/#vf-154400

On the part view you would insert a trailing comma to the parent term, always displayed.

Does this solve this issue?

#1523405

Jim

I think that will not help Beda, but correct me if I am wrong.

The trailing comma for child terms only work for the child terms, but my problem is the trailing comma for the parent term, but only when it has child terms.

That is why I added the comma in the child view before the child term, that way it only displays when there are child items and only before every term (that way there is no trailing comma after the last item)...

So, at the moment it is already working like that except for the space before the comma...

Would appreciate your help getting this to work.

Thnx

#1526535

It was due to the [wpv-filter-meta-html] still present on the View output of the nested views (Uitvoereditor)

Removing it solved the issue, and you don't have a filter here so you can safely remove the front end filter html.

#1526613

Jim

My issue is resolved now. Thank Beda!