Skip Navigation

[Resolved] Toolset layouts conditional statement

This support ticket is created 6 years, 2 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
- 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 -
- 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 3 replies, has 2 voices.

Last updated by Noman 6 years, 2 months ago.

Assisted by: Noman.

Author
Posts
#1119778

Hi,

I have created the if/then statement below based on some support articles form the support forum, but I guess it can be written a little better.

[wpv-conditional if="( '[wpv-post-taxonomy type='product_cat' format='slug']' eq 'tracks-accessories' )" evaluate="false"]
[product_table include="[wpv-post-id]" variantions="separate"]
[/wpv-conditional]
[wpv-conditional if="( '[wpv-post-taxonomy type='product_cat' format='slug']' eq 'tracks-accessories' )" evaluate="true"]
[product_table include="[wpv-post-id]" variantions="separate" columns="length,color"]
[/wpv-conditional]

Fact is that I need the first table to show up when the category is not "tracks-accessories" and second one if the category is tracks-accessories. I believe it can be written a little bit better or in shorthand? But I'm not sure how.. I also couldn''t find the correct documentation on this one, but maybe I overlooked something?

#1119930

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting Toolset support. Sorry, you can not write this code in shorthand format using built in Views conditional shortcodes. Views accepting conditional shortcode in this format:

if (condition == true){
 statements
}

if (condition == false){
statements
}

Here is similar request:
https://toolset.com/forums/topic/wpv-conditional-else/#post-432442

Here is doc for more details:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-conditional
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/#introduction-to-conditional-output

Thank you

#1120729

Thanks for the explanation, so my code is correct?

#1120795

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Yes, It's correct.

Thank you