Saltar navegación

[Resuelto] Conditional display/CPT value

This support ticket is created hace 3 años, 3 meses. 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 -

Zona horaria del colaborador: Asia/Kolkata (GMT+05:30)

Este tema contiene 4 respuestas, tiene 3 mensajes.

Última actualización por fabriceS hace 3 años, 2 meses.

Asistido por: Minesh.

Autor
Mensajes
#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
Colaborador

Idiomas: Inglés (English ) Español (Español )

Zona horaria: Europe/London (GMT+01: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
Colaborador

Idiomas: Inglés (English )

Zona horaria: 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!