Hi,
I've got the following conditional within Elementor:
[wpv-conditional if="( $(wpcf-instant-wins) eq '1' )"]
<h3>[lty_instant_win_prizes_count] Instant Wins</h3>
[/wpv-conditional]
^ Although it doesn't parse on the page, despite adding it to third party arguments. Take it out of the toolset conditional, and it parses and displays fine on the front-end (as you would expect).
So my question is, even with the addition to the third-party arguments, why isn't it parsing and how can I get it to, please?
Thank you.
Hi,
Welcome to Toolset support. Registering [lty_instant_win_prizes_count] under Toolset → Settings → Front-end Content → Third-party shortcode arguments is the correct and required step for using a non-Toolset shortcode with a [wpv-conditional], so that part is right. Two constraints are worth ruling out, though neither is likely your blocker since the shortcode renders fine on its own:
- Toolset processes nested shortcodes only one level deep.
- Conditions containing special characters (single or double quotes, dollar signs) can fail to evaluate — but that applies to the if expression, not to your output, so it shouldn't affect the [lty_instant_win_prizes_count] inside the <h3>.
The pattern that matters here: the nested-shortcode processing that "Third-party shortcode arguments" enables is something Toolset does within its own rendering context. That context is a Content Template — that's where a registered third-party shortcode nested inside a Toolset shortcode is expected to be parsed. When the raw [wpv-conditional] is placed directly into an Elementor widget, Elementor outputs the conditional but the inner [lty_instant_win_prizes_count] isn't handed back to Toolset to process, so it comes through unparsed. That's consistent with it working when you take it out of the conditional (Elementor/WordPress parses the lone shortcode directly).
See if you take the condition back to the Toolset content template it will work?
[wpv-conditional if="( $(wpcf-instant-wins) eq '1' )"]<h3>[lty_instant_win_prizes_count] Instant Wins</h3>[/wpv-conditional]
Then output that Content Template where you need it (assign it to the post type, or insert it into the Elementor layout as a Toolset Content Template) instead of placing the raw conditional in a text/HTML widget.
To confirm the cause before rebuilding, paste the exact same conditional into a Content Template (or the native WordPress editor) and preview it — if it renders there, the issue is isolated to how the shortcode is being processed inside Elementor.
For more information:
1) https://toolset.com/documentation/legacy-features/views-plugin/using-shortcodes-in-conditions/
2) https://toolset.com/documentation/legacy-features/views-plugin/shortcodes-within-shortcodes/
Thanks.
Thank you for explaining the situation in such great detail, we've moved the logic to a Content Template and it seems to have worked perfectly. Thank you.