Skip Navigation

[Resolved] shortcode not showing inside html in elementor text widget

This thread is resolved. Here is a description of the problem and solution.

Problem:

In Elementor page builder text widget, use shortcode as HTML tag attribute.

Solution:

You can try with content template, for example:

https://toolset.com/forums/topic/shortcode-not-showing-inside-html-in-elementor-text-widget/#post-1664551

Relevant Documentation:

https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-post-body

This support ticket is created 3 years, 10 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: Asia/Hong_Kong (GMT+08:00)

This topic contains 2 replies, has 2 voices.

Last updated by jozsefG 3 years, 10 months ago.

Assisted by: Luo Yang.

Author
Posts
#1664371

Hello

I'm redoing a site in Elementor which was made some years back in Divi. Divi unfortunately is a pain in the ass when using CPTs so I switched to Elementor last year. This site needs some new functionality so I decided to port it to Elementor. My problem is that there are cases when I use a taxonomy's description field inside html code. For the Region taxonomy I use it's description to store the color codes of the different region. So my code for a title inside a Destination is like this:

<h1 style="color: rgba([wpv-post-taxonomy type='region' format='description'],1.00);">[wpml-string context="content templates" name="Other Destinations"]Other Destinations[/wpml-string]</h1>

This works in Divi but unfortunately is not working in Elementor. If I just add the [wpv-post-taxonomy type='region' format='description'] shotcode that outputs the region's rgb values, but not when inside html code.
Please help me find a solution to this because I use this approach a lot throughout the site, because every Destination gets is colors based on the Region it is part of.

#1664551

Hello,

It seems to be a Elementor issue, it does not support using shortcode as HTML tag attribute.

As a workaround, you can try these:
1) Create a Toolset content template, for example "my-ct"
Display the HTML codes you mentioned above:

<h1 style="color: rgba([wpv-post-taxonomy type='region' format='description'],1.00);">[wpml-string context="content templates" name="Other Destinations"]Other Destinations[/wpml-string]</h1>

2) In the Elementor text widget you mentioned above, display above content template shortcode, like this:

[wpv-post-body view_template="my-ct"]

More help:
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-post-body

#1664985

Thank you Luo, this works perfectly!

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