Skip Navigation

[Resolved] Only display child taxonomy (where no lower level) in Visual Editor

This support ticket is created 7 years, 6 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 3 replies, has 2 voices.

Last updated by Minesh 7 years, 6 months ago.

Assisted by: Minesh.

Author
Posts
#525762

I am trying to: only display the lowest Child taxonomy in Visual Editor cell.
I have a taxonomy "sports", with various levels (Teamsport - Basketball - 3x3). Some posts will have as lowest level "teamsport", others will delve deeper. Only the lowest level needs to be displayed (with URL)

I'm trying to figure out how to only display the term which has no child (the lowest applicable term).

Is there an easy way to do so?

Thanks

#525794

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

As understand your query that you want to display terms having no child but which terms you want to display?
- All taxonomy terms which has not the child?

#525867

I have a CPT "Sports Providers", linked with a taxonomy "sports" (among others).
Each Sports Provider offers one or more sports.
As an example, there is "All Sports"> Team Sports > Basketball or All Sports>Water Sports>Diving.
In each post, I only want to display Basketball and Diving (the lowest level). A provider can offer many sports.
hidden link

On the link (above), under Activities, there is the taxonomy displayed. Currently, I have only ticked off the lowest level (Basketball or Diving) so it appears with the hyperlink but I would need to have the parents selected as well but not displayed on the Template for Sports Provider.
The reason I want the parents to be selected as well is that the parents would need to be selectable in a search based on taxonomy.

#526133

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

To display the childless taxonomy terms you need to write custom shortcode. You should use the get_terms() function and to get childless taxonomy terms you can use attribute "childless".

More info:
=> https://developer.wordpress.org/reference/functions/get_terms/