[Resolved] Multiple shortcodes in Sections don't appear

Home Forums Support [Resolved] Multiple shortcodes in Sections don't appear

Home Forums Support Multiple shortcodes in Sections don't appear

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #119208
    Daniel Walker

    Hi there,

    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.

    Thanks,
    Dan

    #119230
    Tom
    Lead Developer
    Lead 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 support@generatepress.com so I can take a look?

    Thanks!

    #119237
    Daniel 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?

    Thanks,
    Dan

    #119242
    Tom
    Lead Developer
    Lead 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.

    #119247
    Daniel 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.

    Thanks,
    Dan

    #119377
    Tom
    Lead Developer
    Lead 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?

    #119429
    Daniel 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.

    Dan

    #119657
    Tom
    Lead Developer
    Lead Developer

    Looking into this deeper – will report back ASAP.

    #119771
    Tom
    Lead Developer
    Lead 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-columns

    #119911
    Daniel 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.

    Any ideas?

    Thanks,
    Dan

    #120111
    Tom
    Lead Developer
    Lead Developer

    Excellent, that will help me figure out a fix for this.

    Will update you ASAP 🙂

    #120178
    Tom
    Lead Developer
    Lead Developer

    Can I send you the latest version to see if it’s fixed?

    If so, send me an email to support@generatepress.com and I’ll send it over 🙂

    #120782
    Tom
    Lead Developer
    Lead Developer

    Just released an update that should fix this 🙂

    #121148
    Daniel Walker

    Yes, that’s fixed it. Many thanks, Tom.

    Dan

    #121221
    Tom
    Lead Developer
    Lead Developer

    Awesome, thanks for reporting it 🙂

Viewing 15 posts - 1 through 15 (of 15 total)
  • You must be logged in to reply to this topic.