Skip Navigation

[Resolved] Shortcode in content-template not working

This support ticket is created 2 years, 12 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/Karachi (GMT+05:00)

This topic contains 3 replies, has 2 voices.

Last updated by BenjaminH2340 2 years, 11 months ago.

Assisted by: Waqar.

Author
Posts
#2240925

Hello,

I am currently trying to use a shortcode in a content template in order to insert this in turn via shortcode into an existing layout.

Unfortunately, the shortcode content is not outputting correctly to me.
Behind the shortcode is a function that pulls a link from a custom field of the post, encodes it and combines it with various other parameters to output the desired target link.

If I use the shortcode within Divi, it will be output correctly.
If I use the shortcode in the content template (I used both the old and new editors), it apparently renders incorrectly, if it renders at all.

Under Toolset -> Settings -> Frontend Content -> Third Party Shortcode Arguments, I have already added the appropriate shortcode.

Could someone of you take a quick look at why this is not working?

Thank you very much in advance.

#2241223

Hi,

Thank you for contacting us and I'd be happy to assist.

To suggest some pointers, I'll need to see exactly how this custom shortcode is being used.

Can you please share temporary admin login details, along with the link to the pages where this shortcode can be seen working and not working?
( also include information about where the actual code of the shortcode can be seen )

Note: Your next reply will be private and it is recommended to make a complete backup copy, before sharing the access details.

regards,
Waqar

#2242239

Thank you for sharing these details.

Looking into the template, I noticed that the custom shortcode "tui-unterkunft-direktlink" is returning a URL value.

But in both classic and Gutenberg editors, that shortcode is being used as a value for the id attribute in the "wpv-post-title" shortcode:


<a class="adm_tab2-check24" href="[wpv-post-title id='[tui-unterkunft-direktlink]']" target="_blank" rel="noopener">...</a>

<a class="adm_tab-2-tui" href="[wpv-post-title id='[tui-unterkunft-direktlink]']" target="_blank" rel="noopener">...</a>

It should be passed on directly in the "href" attribute:


<a class="adm_tab2-check24" href="[tui-unterkunft-direktlink]" target="_blank" rel="noopener">...</a>

<a class="adm_tab-2-tui" href="[tui-unterkunft-direktlink]" target="_blank" rel="noopener">...</a>

I hope this helps and let me know how it goes.

#2242527

That's what I tried before.
I've no idea why it is working now, but happy it works 🙂

My issue is resolved now. Thank you!