Skip Navigation

[Resolved] Shortcodes inside Conditional does'nt work

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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

This topic contains 6 replies, has 2 voices.

Last updated by thomasB-2 4 months, 3 weeks ago.

Assigned support staff: Christian Cox.

Author
Posts
#1175186

I am trying to: place a short code inside an condition

Link to a page where the issue can be seen: hidden link

I expected to see: the content of the the Shortcode

Instead, I got: the Shortcode itself.

Inside a layout for WooCommerce Products building with Divi WC Builder i have a problem with the toolset shortcodes.
First we found out that only content placed with square brackets was shown.
https://toolset.com/forums/topic/only-shortcode-will-shown-if-use-of-divi-woolayout-incector-or-divi-wc-builder/
So now i place these shortcode inside square brackets inside an conditional Statement - also in Square brackets. But now the condition work as expected, buth the shortcode inside shows no content, but only the shortcode itself.
[wpv-conditional if="( $(wpcf-dauer) ne '' )"]

Dauer
[types field='dauer'][/types]
[/wpv-conditional]

Test with the automatic generated ones also not helps:
{!{wpv-conditional if="( $(wpcf-dauer) ne '' )" debug="true"}!}
Dauer
[types field='dauer'][/types]
{!{/wpv-conditional}!}

#1175230

Christian Cox
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

It looks like a compatibility issue. Nested Toolset shortcodes do not seem to be supported in the Product layout when I use WooCommerce Builder for Divi. If I create a Layout directly in the Divi Library without using WooCommerce Builder for Divi, then apply that template to a Product, the following code works:

{!{wpv-conditional if="( '1' eq '1' )"}!}
{!{types field="some-field-slug"}!}{!{/types}!}
{!{/wpv-conditional}!}

I'll escalate this to my 2nd tier support team for some additional investigation. I'll let you know what I find out.

#1175231

Christian Cox
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

While I'm waiting to receive additional feedback, I encourage you to let the authors of the WooCommerce Builder for Divi plugin know you're experiencing an issue. I see a link to their support team here: https://www.divikingdom.com/contact/

#1175484

Hi Christian, first of all - a happy new year 😉
I send the request to the divikingdom-support team and inform you if i get some feedback.

Bye Thomas

#1175976

i get feedback from the developer auf Divi WC Builder:
" I've done some testing and here what I got:
1- using the nested shortcodes inside the product content area ( the description builder ) works fine.
2- Using the nested shortcode in the layout in Divi Library, the conditional logic will work but the content will not be rendered correctly, it will be displayed as plain text.
I do not know why this is happening! But it has something to do with this file /plugins/wp-views/embedded/inc/wpv-conditional.php
function wpv_shortcode_wpv_conditional as this function returns the content as it is ( plain text ) without doing the shortcode.
Manually modifying the file fixed the issue, a screenshot is attached.
I don't know how the devs of Toolset plugin will fix this, for now, I suggest using these fields in the description builder and add the Woo Product description module to the layout in Divi Library.
- The way the Wc Builder works is that it applies the content of the Divi Library layout ( the content of Divi Layouts is basically shortcodes ) to the product via template_include filter that overrides the default template of WooCommerce, this could be helpful to Toolset devs."

#1176200

Christian Cox
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

Thank you for the feedback, I will pass that along to our developers.

#1611709

My issue is resolved now. Thank you!