- This topic has 14 replies, 2 voices, and was last updated 8 years, 2 months ago by Tom.
July 7, 2015 at 8:10 am #119208Daniel Walker
When I add a shortcode to multiple Sections on my home page, only one generates the corresponding HTML when the page is loaded in a browser. Is this a issue with the Sections add-on?
It is a simple shortcode that generates a call-to-action button-style link using two attributes: link text and URL. Just a quick and convenient way to add CTAs to a page.
For reference, I am using a child-theme, adding Sections to my ‘Front Page’. I copied page.php from GeneratePress into my child theme and renamed it front-page.php, so nothing complicated there.
DanJuly 7, 2015 at 9:10 am #119230TomLead DeveloperLead Developer
Hmm, I’m using multiple shortcodes on my homepage on this site using Sections with no issues.
Would you be willing to send me temporary admin login details to email@example.com so I can take a look?
Thanks!July 7, 2015 at 9:36 am #119237Daniel Walker
Hi Tom, I would but I’m running WP locally, so it’s all sitting on my PC at the moment. I can send you details of the shortcodes, if that helps? Is there anything else you’d want to see, in terms of code/screenshots?
DanJuly 7, 2015 at 9:40 am #119242TomLead DeveloperLead Developer
Can you try adding a new regular page to see if the shortcodes work? Maybe it’s an issue with your front-page.php template.July 7, 2015 at 9:51 am #119247Daniel Walker
Yes, that worked. So, something about my front-page.php perhaps…although it really is just a copy of page.php. I’ll investigate more tomorrow and let you know if I find the problem.
DanJuly 7, 2015 at 7:33 pm #119377TomLead DeveloperLead Developer
But everything else works on the front-page.php template? Just not the shortcodes? Bizarre..
If the front-page.php is just a copy of page.php, then what’s the point? There must be something custom going on?July 8, 2015 at 3:56 am #119429Daniel Walker
I was using front-page.php for the home page because I was anticipating adding some custom php, but then I discovered the Sections add-on and decided to use sections on my home page instead.
Anyway, I’ve re-created my home page as just a regular page, default template, and added sections to it. When you add shortcodes to multiple sections and publish the page, the HTML appears as expected, but if I then go and edit any of the sections’ content and update the page, none of the shortcodes generate their HTML when the page is viewed.
I tested this again by creating a new test page without Sections. I added a couple of shortcodes in the content editor and published. The HTML appeared as expected. I then went back and edited the content – in both visual and text mode – and updated, and the HTML was again generated by the shortcodes.
So the issue seems to be with editing and updating section content containing shortcodes.
DanJuly 8, 2015 at 11:50 pm #119657TomLead DeveloperLead Developer
Looking into this deeper – will report back ASAP.July 9, 2015 at 10:33 am #119771TomLead DeveloperLead Developer
What shortcode are you using? I can’t seem to reproduce this.
Can you try with my columns plugin?: https://wordpress.org/plugins/lightweight-grid-columnsJuly 10, 2015 at 2:10 am #119911Daniel Walker
Hi Tom, thanks for the link to the columns plugin (very useful, btw!). I added some columns to a few Sections and, as you’ve said, it works fine after updating.
Then it hit me. I was looking at the column shortcode and my link button shortcode in the rich editor and saw this:
[lgc_column grid="25" tablet_grid="50" mobile_grid="100" last="false"] [do action=”call-to-action” buttonurl=”http://435.html” text=”Learn More”/] [/lgc_column]
Whenever I update the page WordPress changes the quotes around the attributes for my shortcode to curly double-quotes, like ‘smart quotes’. Actually it changes them in the rich editor as soon as the page is first published. And it only does that when I use Sections.
My shortcode has two attributes: buttonurl and text, both set to text.
Custom HTML code (copied and pasted from WP shortcode def) is:
<p class="green_button"><a> href="%%buttonurl%%">%%text%%</a></p>
So now we know why my shortcodes aren’t working after publishing, but I can’t think why the attribute quote marks are being changed on my shortcode and not the lcg_column shortcodes.
DanJuly 11, 2015 at 12:00 am #120111TomLead DeveloperLead Developer
Excellent, that will help me figure out a fix for this.
Will update you ASAP 🙂July 11, 2015 at 9:56 am #120178TomLead DeveloperLead Developer
Can I send you the latest version to see if it’s fixed?
If so, send me an email to firstname.lastname@example.org and I’ll send it over 🙂July 13, 2015 at 3:33 pm #120782TomLead DeveloperLead Developer
Just released an update that should fix this 🙂July 15, 2015 at 2:07 am #121148Daniel Walker
Yes, that’s fixed it. Many thanks, Tom.
DanJuly 15, 2015 at 8:57 am #121221TomLead DeveloperLead Developer
Awesome, thanks for reporting it 🙂
- You must be logged in to reply to this topic.