🎉 Happy 4th of July! Get 15% off GP Premium with the discount code: 4THOFJULY2020

[Resolved] Shortcode not working

Home Forums Support Shortcode not working

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #1136390
    Travis

    Hello –

    I’m trying to use shortcodes in a post, but it isn’t working – just to confirm that it wasn’t a specific plugin, I created the following in functions.php

    function test_shortcodes()
    {
    return ‘Shortcodes are working!’;
    }
    add_shortcode(‘test_shortcodes’, ‘test_shortcodes’);

    and entered:
    [test_shortcodes]

    None of it seems to be working – any thoughts?

    #1136459
    Leo
    Staff
    Customer Support

    Hi there,

    Maybe something like this would help?
    https://generatepress.com/forums/topic/inside-hero-hook/#post-928922

    This shouldn’t be theme related 🙂

    #1136461
    Travis

    I’m not trying to create hero oages, I’m trying to use baseline WP shortcode functionality. Switching the theme means shortcodes work. Switching back doesn’t.

    Is there anyone else available to look at this issue that is willing to try to assist?

    #1136463
    Leo
    Staff
    Customer Support

    Does the same shortcode work in a default twenty series themes?

    If you search ob_start in our forum, you can see lots of examples of creating shortcodes:
    https://generatepress.com/forums/search/ob_start/

    Does that help?

    #1136465
    Travis

    Yes, as stated clearly above:

    >I’m trying to use shortcodes in a post, but it isn’t working – just to confirm that it wasn’t a >specific plugin, I created the following in functions.php

    and then stated in my follow up post to your first dismissal:

    >I’m not trying to create hero oages, I’m trying to use baseline WP shortcode functionality. Switching the theme means shortcodes work. Switching back doesn’t.

    *Please* get someone else to respond to this – the last time I had an issue with this theme and tried contacting support, I was similarly frustrated with your response. I need someone to actually provide the support that was supposed to be included with paying for this theme.

    #1136467
    Leo
    Staff
    Customer Support

    Looks like I was able to resolve your last two topics and one was due to your custom CSS error.

    I’ll get Tom to respond to this one.

    #1136470
    Travis

    I also submitted a complaint to Generate Press about the frustration I had with your communication, which apparently was directed to and responded to by you. I look forward to hearing from Tom.

    #1136483
    Tom
    Lead Developer
    Lead Developer

    Hi Travis,

    Sorry for any frustration here.

    GeneratePress itself doesn’t alter the standard WordPress shortcode functionality, so there must be something else in play.

    Do you have any other custom functions added to the theme (maybe the child theme)? Maybe one of those is preventing shortcodes from working?

    Your shortcode function itself looks good.

    Are you adding the shortcode inside your content? If so, are you using a Shortcode block in the editor?

    How are you adding the function? In a child theme?

    Let me know – we’ll figure it out 🙂

    #1136484
    Travis

    Hi Tom,

    Thanks for your prompt attention. The shortcode is being added to a post, but I’ve been experiencing the same issues when adding to the body of pages as well. I have a couple of custom functions, but have primarily been using the elements functionality since it’s a lot easier and less prone to site-breaking… none of them seemed to be causing an issue otherwise.

    I think one of the things that’s vexing is that shortcodes worked at one point and then… didn’t – that test function worked on the 20xx theme previews, so I was able to confirm it wasn’t the plugin that created shortcodes.

    It’s definitely a weird issue…

    #1136486
    Travis

    Ah, and I haven’t been using a shortcode block in the editor – just adding it into the text input using the Classic editor, if that’s of any help.

    #1136487
    Tom
    Lead Developer
    Lead Developer

    Does it work if you use the Shortcode block?

    Can you temporarily disable your other custom functions just to see if there’s a conflict somewhere? Shortcodes should 100% work using GP (we use a bunch of them here on this site), so we just need to find the conflict on your site.

    #1136536
    Travis

    Thanks Tom – disabling the other custom functions seemed to restore the functionality… I’ll go through and re-enable them one by one to see where the issue is.

    I haven’t actually updated any of the functions since well before the issue arose, which is confusing… hopefully that’s all there is to it?

    #1137026
    Tom
    Lead Developer
    Lead Developer

    I assume one of them is filtering shortcodes (maybe). Feel free to share the problem function and I’ll try to spot the issue.

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