Saltar navegación

[Resuelto] Help with [wpv-conditional] within Divi Builder

This support ticket is created 4 years, 11 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 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Zona horaria del colaborador: America/Jamaica (GMT-05:00)

Etiquetado: 

Este tema contiene 12 respuestas, tiene 2 mensajes.

Última actualización por Shane 4 years, 11 months ago.

Asistido por: Shane.

Autor
Mensajes
#2079517

Tell us what you are trying to do?
In a Divi Builder Text module, I am designing a page for some CPT.
In that design, I need to test IF the CPT as a certain field (a check box checked of not). This checkbox field is called 'societe-premium'
I've already used Toolset conditional shortcode in some previous site but here I can't.

The strangest thing is that I am able to display the field but not test it.
Exemple, in this page : enlace oculto (corresponding to a CPT where societe-premium IS CHECKED)
I have a text module with this "text" :

[types field="societe-premium"][/types]
[wpv-conditional if="( $(societe-premium) eq '1' )"]
Premium
[/wpv-conditional]

it should display "1" (and it does !) and it should display premium too ... but it doesn't !! Why is that ??

Many thanks.

Yoann

#2079555

Shane
Colaborador

Idiomas: Inglés (English )

Zona horaria: America/Jamaica (GMT-05:00)

Hi Yoann,

Thank you for getting in touch.

If you add the debug='true' attribut to your conditional can you let me know what is displayed on the frontend?

What I mean is add this to your conditional.

[wpv-conditional if="( $(societe-premium) eq '1' )" debug='true']
Premium
[/wpv-conditional]

I would like to see what your conditional is doing during the processing.

Thanks,
Shane

#2080241

Here is the result now :
1
####################
wpv-conditional attributes
####################
Array
(
[if] => ( $(societe-premium) = '1' )
[debug] => true
)

####################
Debug information
####################
--------------------
Original expression: ( $(societe-premium) = '1' )
--------------------
After matching 1 numeric strings into real numbers: ( $(wpcf-societe-premium) = 1 )
Matched '1' to 1
--------------------
Converted expression: ( '' = 1 )
--------------------

#2080341

Here is the output :
1
####################
wpv-conditional attributes
####################
Array
(
[if] => ( $(societe-premium) = '1' )
[debug] => true
)

####################
Debug information
####################
--------------------
Original expression: ( $(societe-premium) = '1' )
--------------------
After matching 1 numeric strings into real numbers: ( $(wpcf-societe-premium) = 1 )
Matched '1' to 1
--------------------
Converted expression: ( '' = 1 )
--------------------

#2080499

Shane
Colaborador

Idiomas: Inglés (English )

Zona horaria: America/Jamaica (GMT-05:00)

Hi Yoann,

Based on the converted expression the wpcf-societe-premium field is coming out as empty.

Not sure why but can you write your conditional using the shortcode like this below and let me know if this resolves the issue.

[wpv-conditional if="('[types field='societe-premium'][/types]' eq '1')"]

Do something

[/wpv-conditional]

This should produce a result. If it doesn't then add the debug='true ' attribute and share with me the debug information.

Thanks,
Shane

#2081769

Hi again. Doesn't work. Same result.
I've put that :
[types field="societe-premium"][/types]

[wpv-conditional if="('[types field='societe-premium'][/types]' eq '1')" debug="true"]
Do something
[/wpv-conditional]

and it prints that :
1
####################
wpv-conditional attributes
####################
Array
(
[if] => ('' = '1')
[debug] => true
)

####################
Debug information
####################
--------------------
Original expression: ('' = '1')
--------------------
After replacing 1 general variables and comparing strings: ('' = 1)
Comparing to 1

--> It still is converted to nothing whereas I am able to print it (!!!)...... good luck. I am really waiting for your next try. Good luck

#2081879

Shane
Colaborador

Idiomas: Inglés (English )

Zona horaria: America/Jamaica (GMT-05:00)

Hello,

Please allow me to have admin access to the site so that I can check on this in a bit more detail for you.

I've enabled the private fields for your next response. Also please let me know the page where you're experiencing this issue.

Thanks,
Shane

#2081885

Shane
Colaborador

Idiomas: Inglés (English )

Zona horaria: America/Jamaica (GMT-05:00)

Private Fields

#2084509

The problematic page is : enlace oculto

#2084511

BTW the problematic page : enlace oculto

#2084659

Shane
Colaborador

Idiomas: Inglés (English )

Zona horaria: America/Jamaica (GMT-05:00)

Hello,

Can you let me know which template from below has the correct conditional fields?
enlace oculto

Thanks,
Shane

#2088223

Hi Shane,

the template is : "Tous les sociétés". Then look into the first tab.

Thanks.

#2088507

Shane
Colaborador

Idiomas: Inglés (English )

Zona horaria: America/Jamaica (GMT-05:00)

Hello,

This should be working now.

The problem is that divi is overwriting the global variable for the page ID. In order to prevent this so that we can accurately get the data you will need to provide the shortcode like this.

[types field='societe-premium' item='$current_page' ][/types]


[wpv-conditional if="( '[types field='societe-premium' item='$current_page' ][/types]' eq '1' )" debug="true"]
Premium
[/wpv-conditional]

Please let me know if this helps.
Thanks,
Shane