Saltar navegación

[Resuelto] How to use conditions when creating Single Templates in Elementor

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

Problem: Conditionals created for the Divi builder do not work in Elementor.

Solution: Replace the curly bracket syntax around shortcodes with the standard square bracket syntax.

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

Este tema contiene 5 respuestas, tiene 2 mensajes.

Última actualización por peterS-14 hace 6 años, 1 mes.

Asistido por: Christian Cox.

Autor
Mensajes
#1163572

I need to display some fields in a Elementor Single Template based on conditions like: if the user is logged in or based on date values of the field.

As there is no option to do this in Elementor when selecting a field, I have tried the following:

Using the Shortcode- and HTML Elementor Widgets and added the code for conditions there, but without any success.

Before Views 2.6.4 I simply could make a Views Content Template with all the conditional fields in it and it loaded perfectly in the Elementor Post Content Widget.

Any hint is highly appreciated

#1163994

Hi, can you share the conditional code you have tried in the HTML Elementor widget?

#1164113

Hi Christian

thanks for your reply and looking into this.

the code looks like this:

{!{wpv-conditional if="( $(wpcf-event-start-date) lte 'TODAY()' ) AND ( $(wpcf-event-end-date) gte 'TODAY()' )"}!}{!{types field="event-slurl" title="Teleport to Event" class="ts-event-list-detail-link" target="_blank"}!}{!{/wpv-conditional}!}

{!{toolset_access role="Administrator"}!}{!{wpv-conditional if="( $(wpcf-event-start-date) lte 'TODAY()' ) AND ( $(wpcf-event-end-date) gte 'TODAY()' )" evaluate="false"}!}{!{types field="event-slurl" title="Event Location" class="ts-event-list-detail-link" target="_blank"}!}{!{/wpv-conditional}!}{!{/toolset_access}!}

In a Views single template it works perfectly but I cant get this to work in an Elementor Pro Single Template.

#1164569

Hi Christian

I found it: instead of the {!{ }!} i used [ ] and then it works when using an Elementor Text widget.

Probably they where leftovers from using previously Divi Builder

#1164828

Okay, let me know if this issue is not resolved.

#1165379

My issue is resolved now. Thank you!