Skip Navigation

[Resolved] Conditional Display – Show if multiple taxonomies selected

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

Problem:
The user would like to use a conditional shortcode on a taxonomy term for multiple values.

Solution:
We can nest conditions inside the conditional shortcode as follow:


[wpv-conditional if="( CONTAINS(#(building),'Building 1') OR CONTAINS(#(building),'Building 5') OR CONTAINS(#(building),'Building 8') )"]

Relevant Documentation:
https://toolset.com/documentation/user-guides/views/conditional-html-output-in-views/#connecting-conditions

This support ticket is created 4 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
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: Africa/Casablanca (GMT+01:00)

Tagged: 

This topic contains 2 replies, has 2 voices.

Last updated by leilaG 4 years, 7 months ago.

Assisted by: Jamal.

Author
Posts
#1588431

Hi, we are using the below code to display text, depending on if a taxonomy is selected [wpv-conditional if="( CONTAINS(#(building),'Building 1') )"]

If we wanted to text to display if a post had either of the taxonomies selected, how would we add those in to the code, or would we have to do a separate one for each building (Taxonomy term) .

For example, if we want to show the text if a posts has any of the below ticked
Building 1
Building 5
Building 8

#1588897

Hello and thank you for contacting the Toolset support.

You can nest conditions and use an operator like "OR" "AND". Check this article https://toolset.com/documentation/user-guides/views/conditional-html-output-in-views/#connecting-conditions

[wpv-conditional if="( CONTAINS(#(building),'Building 1') OR CONTAINS(#(building),'Building 5') OR CONTAINS(#(building),'Building 8') )"]

I hope this helps. Let me know what you will get.

#1592331

Worked perfectly. Thank you for your help!