[Resolved] How to add a code using hooks only to single page

Home Forums Support [Resolved] How to add a code using hooks only to single page

Home Forums Support How to add a code using hooks only to single page

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #23414
    Pavel

    Hello! I would like to add social buttons (Pluso) using Hooks on single page only (After Content). I add a code <?php if ( is_single() : ?> but buttons anyway shows on the start page too at masonry. How to make them (buttons) disappear from the start page? Actually I need to add the code only to single.php
    Thank you

    #23596
    Tom
    Lead Developer
    Lead Developer

    Hi Pavel, you almost had it – just missing a bracket.

    It should look like this:

    <?php if ( is_single() ) : ?>
    Your buttons in here
    <?php endif; ?>
    #23708
    Pavel

    Hi Tom. I did this but it doesn’t work the way I want for posts at masonry on home page. I want the same effect when I put the code in single.php above <?php comments
    This is a picture of what I got after I did the step that you described.

    #23757
    Tom
    Lead Developer
    Lead Developer

    When you put the code I gave you into Easy Hook, it shows the buttons inside the excerpts on your blog? It definitely shouldn’t – is_single() looks for the a singular post.

    Can you possibly email me at support@generatepress.com with login info so I can take a peak?

    Thanks!

    #23894
    Pavel

    Yes, I’ve sent you an email. Please check.

    #23999
    Tom
    Lead Developer
    Lead Developer

    Hi Pavel,

    In order for the PHP is_single() to work, you need to have “Execute PHP” checked.

    Checking that has solved your problem ๐Ÿ™‚

    #24032
    Pavel

    My mistake. I’m sorry Tom. Thanks for the help! ๐Ÿ™‚

    #24053
    Tom
    Lead Developer
    Lead Developer

    No problem – happy to help!

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