WordPress.org

Ready to get started?Download WordPress

Forums

PHP Code Outside of Loop - Exclude Adsense on Certain Pages (3 posts)

  1. kennyk3
    Member
    Posted 3 years ago #

    Hey everyone,

    I have a site that has Adsense link units right underneath the navigation. I added the code manually so it's not inside the WordPress Loop.

    I was wondering if anyone knew of a PHP snippet that I could use to not show the Adsense link units on certain pages (e.g. Privacy Policy, Contact, About, etc...).

    It'd help out a lot!

  2. alchymyth
    The Sweeper & Moderator
    Posted 3 years ago #

    example:

    <?php if( !is_page( array('Privacy Policy', 'Contact', 'About', 'etc') ) ) : ?>
    ADSENSE CODE HERE
    <?php endif; ?>

    conditional tags
    http://codex.wordpress.org/Conditional_Tags
    http://codex.wordpress.org/Conditional_Tags#A_PAGE_Page

  3. kennyk3
    Member
    Posted 3 years ago #

    Thank you so much!

Topic Closed

This topic has been closed to new replies.

About this Topic