Skip Navigation

[Resolved] Displaying Custom Text for different Taxonmies

This support ticket is created 7 years, 7 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
- 8:00 – 17:00 8:00 – 17:00 8:00 – 17:00 8:00 – 17:00 8:00 – 17:00 -
- - - - - - -

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

This topic contains 1 reply, has 2 voices.

Last updated by Tia 7 years, 7 months ago.

Assisted by: Tia.

Author
Posts
#444166

I am trying to:

Display some text depending on the taxonomy . So I have a content template for my custom post type recipe. Someone lands on a recipe which is under the Vegan taxonomy and I wanted to add a custom message for that particular page. Not sure how to do it with the currently settings.

#444353

Tia

Thank you for contacting Toolset Support. I am happy to help you with this.

For this you would use a wpv-if conditional and the WordPress native function has_term.

[wpv-conditional if="(expression)"]
    What will be done if the expression is true
[/wpv-conditional]

wpv-if Information
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/#check-if-post-has-taxonomy-term

1. Go to Toolset > Settings > Frontend Content > Functions inside conditional evaluations and add has_term

2. Use has_term to evaluate if a post is inside that term:
https://codex.wordpress.org/Function_Reference/has_term

So the code would go like this:

[wpv-conditional if="(has_term( 'jazz'))"]
    What will be done if the expression is true
[/wpv-conditional]

Please let me know if this resolves your question or if it needs more investigation.

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