Skip Navigation

[Resolved] WPV-Condition for Checking if any terms are in a custom taxonomy

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

Problem: I would like to display some text if a post has any taxonomy terms assigned.

Solution: Use a Toolset Conditional block to test whether or not the custom taxonomy is an empty value. Place the Fields and Text block inside the Conditional block.

Relevant Documentation:
https://toolset.com/course-lesson/using-toolset-conditional-block/

This support ticket is created 3 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
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)

This topic contains 2 replies, has 2 voices.

Last updated by albertB-4 3 years, 9 months ago.

Assisted by: Christian Cox.

Author
Posts
#1978587

Hi! I have a custom taxonomy "Skills" for my post type "Creators". I want to display all skills a creator has in a field as "Skills: Directing, Writing, Producing"– IF the post has any skills in the skills taxonomy. If the creator has none, don't display "Skills: ..."

How do I create a condition for this in the fields and text block?

Thanks in advance!

#1978661
Screen Shot 2021-03-08 at 1.37.56 PM.png

Hello, instead of creating a condition in the fields and text block, you could instead place the Fields and Text block inside a Conditional Block. In the conditions for the Conditional block, you can test whether or not any terms exist in the Skills taxonomy. I'm attaching a screenshot here showing a conditional that tests whether the post has any terms in a custom taxonomy "Book taxes" by testing for NOT and empty value. If any terms exist, the contents inside the Conditional block will be displayed. Will this solve the problem for you?

#1979543

That works perfectly, thank you!