WordPress.org

Ready to get started?Download WordPress

Forums

Hide/ Exclude Adsense Ads Sidebar Certain Page (8 posts)

  1. kertoon
    Member
    Posted 2 years ago #

    I know how to hide or exclude Adsense ads from a particular page. But I also do have Adsense ads on the sidebars of the same page. How do I hide the ads on the sidebars?

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

    if the ads code is in a widget, consider using a plugin such as http://wordpress.org/extend/plugins/widget-logic/ or http://wordpress.org/extend/plugins/conditional-widgets/ or similar

  3. kertoon
    Member
    Posted 2 years ago #

    Thank you Alchymth.

  4. kertoon
    Member
    Posted 2 years ago #

    Then how do I hide more than one Adsense code from more than one page. What I presently do to hide one page is I use this code:

    <?php if($post->ID != xxxx): ?>
    (Adsense code)
    <?php endif; ?>

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

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

    or try:

    <?php if( $post->ID != xxxx && $post->ID != yyyy && $post->ID != zzzz ): ?>
  6. kertoon
    Member
    Posted 2 years ago #

    I use your second option and it works. Thanks. What about hiding Adsense for PAGE? I have two PAGES (Disclaimer & Sitemap).

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

    I already posted the link to the 'conditional tags' chapter of the Codex - so you have all the neccessary information; try to apply the info and play with the possibilities.

    if you need info for php if/elseif/else, and logical operators, please search the web for tutorials.

  8. kertoon
    Member
    Posted 2 years ago #

    Alright, I'll do that. Again a big thank you for your help.

Topic Closed

This topic has been closed to new replies.

About this Topic