Skip Navigation

[Résolu] Is there a way to filter taxonomy for the lowest item in each taxonomy branch?

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem:

I want the LOWEST item in each taxonomy branch.

e.g. if a post is tagged as "Asia / Thailand / Bangkok" I want it to return "Bangkok.

Solution:

There isn't such kind of built-in feature within Toolset plugins, You need to edit that post, assign it with only one term.

Relevant Documentation:

This support ticket is created Il y a 3 années et 3 mois. 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.

Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.

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)

Ce sujet contient 4 réponses, a 2 voix.

Dernière mise à jour par PaulS4783 Il y a 3 années et 3 mois.

Assisté par: Luo Yang.

Auteur
Publications
#2146377

ToolSet has a nice taxonomy filter option in Views of "Parent = none".
This will return the HIGHEST item in each taxonomy branch.
e.g. if a post is tagged as "Asia / Thailand / Bangkok" it would return the taxonomy term "Asia"

But actually I want to go in the opposite direction.
I want something like "Child = none".
Meaning that I want the LOWEST item in each taxonomy branch.
e.g. if a post is tagged as "Asia / Thailand / Bangkok" I want it to return "Bangkok.

Is there a way I can do this either with ToolSet native functions or with a Short Code custom taxonomy filter?

#2146521

Hello,

There isn't such kind of feature within Toolset Views/Blocks plugin, see WP document:
https://developer.wordpress.org/reference/classes/wp_query/#taxonomy-parameters

include_children (boolean) – Whether or not to include children for hierarchical taxonomies. Defaults to true.

The parameter "include_children" will setup as true by default, so in your case, you just need to edit each post, assign it with only one lowest term, for example "Bangkok", and test again.

#2146531

"The parameter "include_children" will setup as true by default, so in your case, you just need to edit each post, assign it with only one lowest term, for example "Bangkok", and test again."

Sorry. I can't understand what you are telling me to do here.

#2146545

As I mentioned above, there isn't such kind of built-in feature within Toolset plugins to achieve what you want:

I want the LOWEST item in each taxonomy branch.
e.g. if a post is tagged as "Asia / Thailand / Bangkok" I want it to return "Bangkok.

You need to edit that post, assign it with only one term: Bangkok

Hope it is clear.

#2147179

You can close the ticket.