Skip Navigation

[Resolved] Nested shortcode problem in content template

This support ticket is created 3 years, 2 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 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 - - 9: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: Africa/Casablanca (GMT+01:00)

This topic contains 10 replies, has 4 voices.

Last updated by Jamal 3 years, 1 month ago.

Assisted by: Jamal.

Author
Posts
#2229913

Hello.

1) I have problem with nested shortcode in impreza content template.

For example if i use shortcode

[wpv-conditional if="( $(wpcf-vr) eq '1' )"][types field='time' output='raw'][/types][/wpv-conditional]
It renders only first shortcode, but not nested and it displays on frontend like

[types field='time' output='raw'][/types]
And if i use this nested shortcodes on any page - everything works good.

How can i fix that problem?

2) Also i have problem with shortcode if it used as attribute value for other shortcode in impreza theme content template.

For example if i use shortcode
[qbook_timesheet roomid=[types field='id'][/types] view=timeslots_new days=7]

It renders only first part of shortcode and it displays on frontend like:
[/types] view=timeslots_new days=7]

And if i use this shortcode as attribute in toolset plugin content template or in page - everything works good.

How can i fix that problem?
Provided URL: hidden link

#2230261

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Denis,

Thank you for getting in touch.

I suspect that this is being caused by the changes in the wordpress shortcode API some years ago.
https://make.wordpress.org/core/2015/07/23/changes-to-the-shortcode-api/

We had made special adjustments to our plugins to allow for the nesting of shortcodes when you're using our content templates. Some other plugin authors have also made this adjustment to their plugins to allow for the nesting of shortcodes and shortcodes as parameters to continue to work since wordpress core doesn't support it anymore.

Unfortunately if the impreza content template doesn't support the nesting of the shortcodes then there isn't much we can do since the shortcodes will be going through their templates.

An example of this is that it works fine with our Toolset templates but doesn't work with the impreza templates.

Please let me know if this clarifies the issue for you.

Thanks,
Shane

#2232181

Hello.

But this type of nested shortcode [wpml-conditional lang="ru"][wpv-post-title][/wpml-conditional] works good in impreza content template.
Such problem only with toolset shortcode in impreza content template.

#2233231

Minesh
Supporter

Languages: English (English )

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

Shane is on Vacation. This is Minesh here and I'll take care of this ticket. Hope this is OK.

Can you please send me problem URL where I can see the issue as well as admin access details.

*** 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.

#2235259

Minesh
Supporter

Languages: English (English )

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

It seems when you add nested shortcodes within the WPBakery page builder it does not have capacity to parse it correctly.

I've created the following content template - and added the same shortcodes to it.
=> hidden link

1) problem with nested shortcode in impreza content template.
[wpv-conditional if="( $(wpcf-vr) eq '1' )"]
[types field='time' output='raw'][/types]
[/wpv-conditional]

2) problem with shortcode if it used as attribute value for other shortcode in impreza theme content template.

[qbook_timesheet roomid='[types field='id' output='raw'][/types]' view='timeslots_new' days='7']

And I just added it below your section using the content template:
=> hidden link

[wpv-post-body view_template='ct-for-nested-shortcode']

I can see it renders the ID: 60
hidden link

#2235273

Thanks for quick reply.
So this is a problem with wpbakery? Is it possible to fix that?

It will not be very convenient to create separate templates each time.

And second shortcode doesnt display anythind, but it must display schedule

#2235279

Minesh
Supporter

Languages: English (English )

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

I show you workaround, I'm not sure about other shortcode as as its third party shortcode and I'm not sure if that shortcode is capable of parsing nested shortcodes. We have limited integration with WPBakery page buidler:
=> https://toolset.com/course-lesson/using-toolset-with-wpbakery-page-builder/

Normally, it should work but I also see some notices on your site at top of the page from the qbook plugin. You should check with qbook plugin author and check with them if you are allowed to pass nested shrotcode to their shortcode "qbook_timesheet " and present the current situation.

#2235281

[qbook_timesheet roomid='[types field='id' output='raw'][/types]' view='timeslots_new' days='7']
this shortcode works good in toolset content template.

#2237991

Minesh
Supporter

Languages: English (English )

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

Can you please share the link of the post/page where I can see the shortcode works?

- What if you disable the Toolset plugins and then add the shortcode to WPBakery page builder's text module - does it works?

[qbook_timesheet roomid='9999' view='timeslots_new' days='7']

Where replace 9999 with original roomid value. for now to check we will use the static value as we disable the Toolset plugins.

#2239887

Of course this code work.

You can test it here for example hidden link

#2240529

Minesh won't be available for a couple of days. If you don't mind, I'll continue with you on this ticket.

From what I gathered so far, I would say that Impreza templates execution environment is not aware of nested shortcodes. Even if the wpml-conditional shortcode works with nested shortcodes. WPML takes care of executing the shortcodes inside of its wpml-conditional shortcode. But the Impreza templates do not.

I am afraid that the only workaround, is the one suggested by Minesh(#2235259). You will need to use an intermediary Toolset content template for any nested codes. This way, Impreza executes only one shortcode(to invoke the Toolset content template), and then the Toolset content templates takes care of the nested shortcodes within it.

I can escalate this to our development team, but I am pretty sure, we won't invest time on it, as it is a different execution environment than us. This has been reported for Elementor templates and we have decided to not support it if they do not. This brings us to the only workaround: Using a content template for any nested shortcodes. I know that could be cumbersome, but that's the price to pay to use all the different technologies involved(Toolset+Impreza+WPBakery).

I hope this helps. Let me know if you have any questions.