Skip Navigation

[Resolved] Help displaying only the primary taxonomy term in [wpv-post-taxonomy] shortcode

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

Problem: I would like to use the wpv-post-taxonomy shortcode to output only the top-level term associated with a post.

Solution: The wpv-post-taxonomy shortcode isn't filterable like this, so you would have to use a View of taxonomy terms, set by the current post, where the parent term is "None".

This support ticket is created 4 years, 10 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.

Our next available supporter will start replying to tickets in about 0.06 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Author
Posts
#1269923

I am modifying my search results template. I would like to display only the primary taxonomy term in the [wpv-post-taxonomy] shortcode.

Here is my example: right now I have it set to display hidden link type="online-class" format="slug"].

If the post has more than one taxonomy term selected, the resulting url will be something like "hidden link, toe-up-socks, top-down socks."

Is there a way I can specify this shortcode to only display the primary taxonomy term? Something like [wpv-post-taxonomy type="online-class" format="slug" hierarchy="primary"]...?

Thanks!

#1270041

Hi, no unfortunately you can't customize the output of the wpv-post-taxonomy shortcode like this. Instead, you could use a taxonomy View. Add a taxonomy parent filter where parent is "None", which will return only the top-level terms. Then add a taxonomy term filter "set by the current post", which will get the terms from the current post in the archive loop. In the View's Loop, you could output a link to the taxonomy term archive, or create a link using your own HTML. Insert the taxonomy View in the loop output of your search results archive.

#1276803

My issue is resolved now. Thank you!

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