Skip Navigation

[Resolved] Shortcode inside custom field and Elementor

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

Problem: I have a 3rd-party slideshow shortcode that I would like to display on my posts. The shortcode will be different for each post, so I want to place it in a custom field. Then in my Elementor template, I would like to insert that custom field to display the rendered 3rd-party shortcode. It doesn't seem to be working as expected when I use Elementor's dynamic content feature.

Solution: Try inserting the Types field shortcode in a Text module. You'll have better results with complex field data this way, and get better access to field options. We are continuing to improve our integration with Elementor.

100% of people find this useful.

This support ticket is created 5 years, 11 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 13 replies, has 3 voices.

Last updated by Sarah Pickert 5 years, 11 months ago.

Assisted by: Christian Cox.

Author
Posts
#1195120
Page-with-slider.jpg

Hi, we are building a dynamic template in Elementor where the template is fetching various content from custom fields in custom posts that we have set up with Toolset types. There is one thing that we don't get working and after a lot of searching for information and testing with different Toolset custom types, we have gotten stuck. We would very much appreciate if you can point us in the right direction.

What we are trying to do is the following:
In the custom posts we want to have a custom field where we can insert a shortcode from SmartSlider 3, so that the slider will appear on the post/page that we have created with an Elementor single template.

What we have tried:
If we insert the shortcode in default content field of the post and use the Elementor (single) post content widget, the slider shows up fine on the page. Problem is that we want to use the content field elsewhere and would like to use a Toolset custom field for the shortcode instead, but whatever combination of Toolset custom field and Elementor widgets we cannot make the slider to show up.

Our question:
Isn't there any Toolset custom field type we can use, so that we can make Elementor understand that we want Elementor to "trigger" the shortcode?

I have attached a screenshot of the page where you can see how the slider appears on the page when we use the default content field together with the Elementor post content widget. We would like to use a Toolset custom field instead and get the same result.

Regards,
Jan

#1195156

Hi, a WYSIWYG field is the best type of field to use when you want to embed shortcode(s). Then use the Types field shortcode to render the WYSIWYG field, for best results:
https://toolset.com/documentation/customizing-sites-using-php/functions/#wysiwyg

If that doesn't work as expected, we may need to take a closer look.

#1195240

Hi, thanks for your reply!

I tried out the WYSIWIG field already yesterday several times, because I thought that could be the thing, but I couldn't get it to work. I tried again this morning, using several different Elementor widgets (including their shortcode widget), but it still doesn't display. Do you have any recommendation of which Elementor widget I should try?

Regards
Jan

#1195243

Hi again, an update:

When using the WYSIWIG field together with the Elementor shortcode widget, Elementor picks up and displays the Smartslider code in live mode, but doesn't render the Slider. I also double checked and inserted the Smartslider shortcode straight into the Elementor shortcode widget. It works fine, the slider renders as expected. So the problem doesn't seem to be with Elementor.

//Jan

#1195510

I would use a Text element in your Elementor template, then insert the types field shortcode for your wysiwyg field in the text element. If that's not working as expected, I can try running some tests with that plugin on my own environment. Since it's a paid plugin, I would need you to upload a copy somewhere and provide a download link. All URLs are obscured in the forum by default, so it will remain confidential.

#1195655

I have tried with the text widget and several other widgets as well, but Elementor still doesn’t render the slider. It would be great if you can have a look. I can provide you with credentials so that you can log in to and test on a dev site that we are using for this project.

#1195687

Okay, I will take a look. Private reply fields are active here.

#1197461

Hi, the HTTP authentication credentials worked for me, but I'm unable to log in to wp-admin using the password you provided. Can you check and update the credentials for me?

#1197533

Okay it looks like there was a problem because slider #11 was on the same page twice - once in the page content and another time in the template. The Smart Slider system apparently doesn't like to display the same slider twice, and there was a JavaScript error. I switched the custom field value to a different slider, #9, so you can see now. In the post custom field:

[smartslider3 slider=9]

In the Elementor template:

[types field="smart-slider-3"][/types]
#1197545

Thanks Cristian,

I had tried with one slider on the page as well before, but didn't get it to work. Seems that I did it the wrong way. Now I see that you haven't used Elementor Dynamic field dropdown in the widget like I had done. Instead you have referred to [types field="smart-slider-3"][/types] in the text field of the text editor without using Elementors dynamic dropdown.
So it cant be done using the dynamic dropdown in the Elementor widget?

#1197551

No, I think not. Integration between Types and Elementor's dynamic content menu is still pretty new, and it works best with fields that store simple content. You can always create a Content Template or View and use the Toolset menus to insert the proper shortcode, then copy + paste that into the Elementor template. It's a couple more steps, but it will give you the ability to work with more complex field types and to select all the options you want in the popup menus.

#1197552

Ok, I understand. Thank you for the help.

#1197554

My issue is resolved now. Thank you!

#1669077

In the reply #1197533 ... is the custom field slug defined by toolset titled "smart-slider-3" OR is "smart-slider-3" the slug defined by this 3rd party slider too.

I am trying to accomplish the same thing referencing the Gravity Forms shortcode and am running into similar described issues that may be resolved with that clarification.

New threads created by Christian Cox and linked to this one are listed below:

https://toolset.com/forums/topic/render-a-gravity-forms-shortcode-inside-a-custom-field/