Archived topic
After Content Hooks displays on Home Page too
7 replies · Started by Dave on February 27, 2017
I was trying to add a short code to my after content hooks so it will just add to my full posts but it displays on my home page after each recent post which I don't want it to. I just want it after the full post.
Hi Dave,
So you only want the hook to show up on single post pages? If so try adding this in the hook:
<?php if ( is_single() ) : ?>
Insert content here
<?php endif; ?>
Make sure Execute PHP is checked.
Let me know if this answers your question.
Hey Leo,
That worked. Thanks!
You're welcome :)
Hi tried above code for 'After Content' GP hook but it's showing on only POSTS.
I want to show it on PAGES as well.
What changes do I need to do in the following code?
<?php if ( is_single() ) : ?>
Insert content here
<?php endif; ?>
Hi there,
if you are using GP 1.7 then you can use the Hook Element - you won't need the PHP condition as it has display rules built in:
https://docs.generatepress.com/article/hooks-element-overview/
perfect, your help is appreciated!
You're welcome