Archived topic
Conditional for GP Hooks
3 replies · Started by Jam on June 1, 2017
Hi
I have a few hooks that I only want in certain pages.
For a hook that's excluded on the homepage, I use this:
<?php if ( ! is_front_page() ) : ?>
content
<?php endif; ?>
My questions are:
1) how should the conditional be if I want this same hook to be excluded in
- homepage
- categories
- pages
- archives
that is, I only want it on individual posts
2) And what's the code if I only want it on individual pages and posts?
Thanks a lot
Hi there,
1)
<?php if ( is_single() ) : ?>
content
<?php endif; ?>
2)
<?php if ( is_single() || is_page() ) : ?>
content
<?php endif; ?>
More info here: https://codex.wordpress.org/Conditional_Tags
Great! Thanks for the quick reply, Leo!
Glad I could help :)