Archived topic
Custom Content Shortcode bug?
1 reply · Started by Ian on October 4, 2020
I've been using the Custom Content Shortcode (CCS) plugin with GeneratePress successfully for several years. However, when I use it in Elements (hook, home page), some of my generated links are truncated. The links are fine if used in regular posts. For example, this CCS snippet:
[loop type=news count=4]
[field url]<br>
<a href="[field url]">
[field title]<br>
[field excerpt words=15] ...
</a>
[/loop]
Used via Elements, it displays:
https://www.mydomain.com/news/my-post-title-001
<a href="https://www.mydomain.com/">My Post Title
This is an example excerpt.</a>
The post URL [field url] is successfully displayed, EXCEPT when used inside the HREF tag. This problem does not arise when the snippet is used on an actual page, or in a post.
There has been discussion in the Custom Content Shortcode plugin forum as to the possible cause, but I don't know whether this is something that GeneratePress could address?
Hi there,
That's strange, I'm not sure what could be causing that within Elements - we simply use the core do_shortcode() to render shortcodes in the content area.
I think doing something like this is your best bet: https://wordpress.org/support/topic/shortcodes-not-working-inside/#post-10800074
That way you're not adding shortcodes into HTML markup - the entire link is rendered in a shortcode.