Archived topic
How to add a code using hooks only to single page
7 replies · Started by Anonymous on September 2, 2014
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
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; ?>
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.

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!
Yes, I've sent you an email. Please check.
Hi Pavel,
In order for the PHP is_single() to work, you need to have "Execute PHP" checked.
Checking that has solved your problem :)
My mistake. I'm sorry Tom. Thanks for the help! :)
No problem - happy to help!