Skip Navigation

[Resolved] Conditional shortcodes within a Divi Builder template

This support ticket is created 4 years, 9 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 2 replies, has 2 voices.

Last updated by garyC 4 years, 9 months ago.

Assisted by: Minesh.

Author
Posts
#1514421

I have a Divi builder template that is assigned to a CPT that displays a number of custom fields.

I am trying to create a conditional shortcode that will hide a title and field if they have no content. I am using the code below, without success. I have added this to a Divi text module and a code module, and swapped out the "[ ]" bracket for "{!{" curly brackets but to no avail. I am basing the code on a previous query that was added here: https://toolset.com/forums/topic/how-to-use-conditions-when-creating-single-templates-in-elementor/

[wpv-conditional if="( $(wpcf-alternative-visits) eq '' " evaluate="false"]<h3>TITLE 1</h3>
[types field='alternative-visits'][/types][/wpv-conditional]

[wpv-conditional if="( $(wpcf-further-afield) eq '' " evaluate="false"]<h3>TITLE 2</h3>
[types field='further-afield'][/types][/wpv-conditional]

It simply displays the titles and the toolset shortcode beneath it. You can see an example of a page here, though I have removed the shortcodes for now. I need to conditionally remove the Alternative Visits and Further Afield sections.

hidden link

Thanks.

#1515763

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

Basically - code module does not support the conditional statements. Normally - you need to add the conditional statements to text module.

Can you please share admin access details so I can check further:

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#1520543

My issue is resolved now. Thank you!