• Hello all!

    I’m running wordpress 2.9.2 and and Adsense – and I have included a privay policy on my site.

    Now, as it is created as a page, an adsense unit is automatically included (2, actually).

    Does anyone know how to disable these ad blocks on just this one page?

    Thanks!

    /L

Viewing 6 replies - 1 through 6 (of 6 total)
  • cover the adsense code in template with this condition.

    <?php if($post->ID != xxx): ?>
    // you adsense code
    <?php endif; ?>

    While xxx is the ID of the page that you want to exclude adsense.
    The post id is in the URL when you edit the page in backend.

    Thread Starter lankydd

    (@lankydd)

    Oh, thx for so much!

    // you adsense code – does that mean my publisher number or the whole script snippet that I dont want to display?

    Hi,

    The whole script that you already have it in the template.
    You just need to cover it by php condition.

    @ninenote

    This fix works great for one page! Thanks for posting.

    But I can’t seem to make this work for multiple pages. Can you help?

    I’ve tried all of the following, and none of them work for more than one page:
    <?php if($post->ID !=xxx,yyy,zzz): ?>
    <?php if($post->ID != xxx,yy): ?>
    <?php if($post->ID !=’xx’,’yy’): ?>
    <?php if (!is_page(array(‘Page Title’, ‘other-page-title’, 29))) { ?>

    I know there’s an easy fix, and I’ll probably kick myself later. But I’m about ready to pull my hair out!

    I’ve got several other php exclusions running just fine (like excluding specific pages when the “list all” feature is used, etc…). I’m at a loss…

    O_o

    Thanks!

    Oh wow. Nevermind.

    It would help if I were using the proper closing tags.

    DOH!

    >_<

    I tried the

    <?php if (!is_page(array( ‘Blog’, ‘Quotes’, ‘Archives’, ‘Products’))) { ?>

    ~~~adsense code goes here~~~

    <?php } ?>

    it works in all pages except the ‘Blog’ page.. I also tried putting the page number. any ideas?

    PS ‘Blog’ page is not Home Page, it used to be called ‘Home Page’. Maybe it has another name value?

    Check https://www.lifepath4u.com

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Remove adsense from just one page’ is closed to new replies.