Skip Navigation

[Resuelto] Conditional in post content is not working

Este hilo está resuelto. Aquí tiene una descripción del problema y la solución.

Problem: The curly bracket conditional syntax is not working when it's inserted in the post content editor.

Solution: Replace the curly brackets with square brackets in a post editor. The curly brackets should be used in a WPBakery module.

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

Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Etiquetado: 

Este tema contiene 5 respuestas, tiene 2 mensajes.

Última actualización por marcB-6 hace 6 años, 4 meses.

Asistido por: Christian Cox.

Autor
Mensajes
#1069288
Schermafbeelding 2018-07-31 om 15.36.10.png

I am trying to:
Add conditionality to a text block in the Visual Composer.
See screenshot for the test.

I expected to see:
Either 'empty' or 'not empty' in the frontend.

Instead, I got:
Nothing is seen in the frontend.

#1069437

Hi, can you try these troubleshooting steps and let me know the results?
- Update Types and Views to the latest versions, then test again.
- Deactivate all plugins except VC, Types, and Views and test again.

If neither of these solves the problem, I need access to the Salient WPBakery plugin your site is using. Can you provide a download link in the private fields here? The fields may say Duplicator package but any download link will work.

#1069519
Screen Shot 2018-07-31 at 3.40.52 PM.png
Screen Shot 2018-07-31 at 3.40.57 PM.png

Is the screenshot you provided a post content editor, or a WPBakery text module? I'm not sure, but it looks like maybe it's a post content editor. If it is a post content editor, then you should replace the curly bracket syntax {!{ ... }!} with the standard square bracket syntax:

[wpv-conditional if="( $(wpcf-testfield) eq '' )"]Empty[/wpv-conditional]
[wpv-conditional if="( $(wpcf-testfield) ne '' )"]Not empty[/wpv-conditional]

The curly bracket syntax is for use in a WPBakery module. When you use the GUI in the post content editor, it should build the correct shortcode for you. I just tested this out in my local clone and it seems to be working as expected. Maybe these curly bracket conditionals were copy + pasted from a WPBakery module?

#1070019
Schermafbeelding 2018-08-01 om 08.15.29.png

Hi Christian,
I indeed changed the syntax to the curly brackets in a attempt to solve the problem before escalating to you.
However, the square brackets result in the same problem (see attachment).
Can you try it on my instance? You can use same creds on: enlace oculto
The post where i tested is: enlace oculto
Thanks!
Marc

#1070231
Screen Shot 2018-08-01 at 8.44.48 AM.png

Looks okay to me, I see "Empty" before the lipsum text. Isn't that the expected behavior here?

#1071592

Aaah, so stupid. I was suspecting it on top of this text, not inline.
Excuse me and thanks for your help.
Marc