Site logo

Archived topic

Hooks on pages & single posts

3 replies · Started by imraan-ftg on August 24, 2017

Viewing posts 1–4 of 4

I am looking to achieve following:

1) I need a section above copyright (footer) on all the pages except post page.

I added a hook under > After Footer widget and the content is visible. However, its getting displayed on all the pages including single posts

See > http://myprintscreen.com/s/mlbs/0589a662de

2) Need a image (ad section) between post content and comments on single post.

I added a hook under > After Content and the content is visible. However, its getting displayed on all the pages (site wide)

See > http://myprintscreen.com/s/mlbt/b29a158237

Hi there,

1) Try this:

<?php if ( ! is_single() ) { ?>
    Content in all pages except (!) single post pages
<?php } ?>

2) Try this:

<?php if ( is_single() ) { ?>
    Content in all single post pages
<?php } ?>

Make sure execute PHP is checked. More info on conditional tags here: https://codex.wordpress.org/Conditional_Tags

Thats awesome

Yup it is :)

This archived topic is closed to new replies.