Skip Navigation

[Resolved] Conditional display/CPT value

This support ticket is created 2 years, 6 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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: Asia/Kolkata (GMT+05:30)

This topic contains 4 replies, has 3 voices.

Last updated by fabriceS 2 years, 6 months ago.

Assisted by: Minesh.

Author
Posts
#2355245

HI

I'm trying to compare the value of what I'm displaying in order to change the word in front of it in the View ID 7713.

What I'm displaying is : item="@ski-station-property.parent"
I need to make a conditional display following this item as the value "Deux Alpes" or not.

Can you please help me to find out the way to achieve this ?

Many thanks.

#2355441

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

What field are you displaying with that item attribute, and how? Using a shortcode?

You should be able to use a conditional shortcode where you test the output of that shortcode, e.g. assuming your are checking the post title of the parent post it would be something like this:

[wpv–conditional if="( '[wpv-post-title item='@ski-station-property.parent'] eq 'Deux Alpes' )"]Your conditional content[/wpv–conditional]
#2358941

Thank you very much Nigel.

Another question. Is there like in the past with the basic programming "if, then, else" a way to do the ELSE ?

Actually I need to have
IF
condition 1 or condition 2 or condition 3... THEN

ELSE do something else.

in my case
if item='@ski-station-property.parent'] eq 'Deux Alpes' OR item='@ski-station-property.parent'] eq 'Les Gets'
then display Content template 1

ELSE display Content template 2

how to do that ?

#2359025

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

There is no else condition but you should try to use the following conditional statements:

[wpv–conditional if="( '[wpv-post-title  item='@ski-station-property.parent'] eq 'Deux Alpes' ) OR ( '[wpv-post-title  item='@ski-station-property.parent'] eq 'Les Gets' )"]
display content template 1
[/wpv–conditional]

[wpv–conditional if="( '[wpv-post-title  item='@ski-station-property.parent'] ne 'Deux Alpes' ) OR ( '[wpv-post-title  item='@ski-station-property.parent'] ne 'Les Gets' )"]
display content template 2
[/wpv–conditional]
#2359917

My issue is resolved now. Thank you!