Skip Navigation

[Resolved] Nested shortcodes in Elementor widgets – FIX

This support ticket is created 3 years, 6 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 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Tagged: 

This topic contains 2 replies, has 2 voices.

Last updated by stuart 3 years, 6 months ago.

Assisted by: Shane.

Author
Posts
#1783447
heading example.jpg

This is a possible solution for the nested shortcode issue in Elementor.

Ok, so I have had a couple of issues when trying to use nested shortcodes in Elementor - and there is a specific case where the Header and Footer elements in Elementor are particularly problematic.

The issue would produce this at the end of the result: "] , or if in the header entirely break the content section.
[ Example other tix: https://toolset.com/forums/topic/using-nested-shortcodes-in-elementor-widget/ ]

You could use a Text widget in Elementor and this would allow for adding conditionals etc, however, this would not always work in the Footer, or Header due to the way it renders the_content (I believe).

You can also put nested shortcodes in an unassigned content template and this does work, but only in the body of the Elementor page - not the header and footer, this break it.
[ Example other tix: https://toolset.com/forums/topic/nested-conditions-in-elementor-page-builed/ ]

I needed to use a Toolset View with a nested shortcode in the footer, to do this I needed to create my own shortcode to house the whole string and then I could use this in any element in Elementor such as a Header element.

You will need to create a function in either the functions.php or in the Toolset custom code section (Toolset >Settings>Custom Code).

add_shortcode('link-output', 'link_output');

function link_output( $args ) {
$ids =  do_shortcode('[wpv-post-id]'); 
$link = do_shortcode('[wpv-view cached="off" name="international-links"'.' ids="'.$ids.'"]');
return $link;
}

I created the view I needed and then broke down the variable needed, then combined them in the output.

[link-output] was then used in the shortcode within the Elementor element.

Now you don't have to do this with views, but with any other nested shortcode, you need to apply.

I hope this saves a headache for someone else.

#1784673

Shane
Supporter

Languages: English (English )

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

Hi Stuart,

Thank you for getting in touch.

Thank you for sharing this solution, what you can do is go ahead and mark this thread as resolved and I can add it to the thread summary so that it's much easier to find for user's who are experiencing the same issue.

Thanks,
Shane

#1786923

My issue is resolved now. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.