Black Friday sale! Get up to 25% off GP Premium! Learn more ➝

[Resolved] Shortcode Display Area

Home Forums Support [Resolved] Shortcode Display Area

Home Forums Support Shortcode Display Area

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #325602
    Satori

    Hello! right now I’m using elementor to make templates and assign them via shortcode in the GP hooks widget. Inside my article everything looks fantastic. But on my pages it is simply not nice, I wonder if there’s a way to display the shortcodes only on certain areas. I know nothing about coding, but maybe a “PostOnly” solution may exist.

    #325603
    Satori

    Sorry I didn’t include the link, this is the website: https://luzocultaoficial.com/

    And the template I want to remove from pages is the social share bar. I just want it to be seen in the post page.

    #325674
    Leo
    Staff
    Customer Support

    Hi there,

    I’m not 100% sure what you mean but sounds like you need to wrap the shortcode with conditional tags inside hooks so that it only shows on posts/pages: https://codex.wordpress.org/Conditional_Tags

    Let me know if this helps or if you need more info πŸ™‚

    #325878
    Satori

    Hi Leo! Thanks in advance for your support. Yes, this seems to be the answer for my request. Sadly I don’t know anything about coding, my brother is learning so he did try to apply the conditional tag without success. If it isn’t too much to ask, could you please tell me what is the exact piece of code you’d put to display a shortcode only on a single post page. And will this be applied in the Hook area?

    Here are some screenshots for you to see my exact problem. The Social Share bat and the Related Posts area are being displayed via shortcode, they were created in Elementor. Of course I don’t want them to be on my main page nor blog or category page, I just need them on the single post page.

    Hope you can help me.

    Screenshot gallery: http://bit.ly/2sfnTq0

    #325901
    Leo
    Staff
    Customer Support

    Try something like this in hooks and make sure Execute PHP is checked:

    <?php if ( is_single() ) { ?>
        Insert Shortcode here
    <?php } ?>

    Let me know.

    #326087
    Satori

    It works like a charm! Thank you Leo for your support, whenever you come to Mexico let me know, I’ll share with you some delicious tacos! Best vibes.

    #326150
    Leo
    Staff
    Customer Support

    haha you are welcome! I do love tacos πŸ™‚

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