Wednesday, February 23, 2011

Show Adsense Ads/WordPress blog and other Ads Only on Home page or Post pages of Blogger

 You can find the similar post related to it. But here is the simpler procedure you will like. you want to show the ads only on Home page or Posts pages of blogger and wordpress.

Show Adsense Only on Home page or Post pages of Blogger blog

Show ads on Home Page only

your ad code as below:

<b:if cond='data:blog.pageType != &quot;item&quot;'> YOUR AD CODE </b:if>

Show ads on Individual Posts Page only

put your ads code between the red code :

<b:if cond='data:blog.pageType == &quot;item&quot;'> YOUR AD CODE </b:if>

Show Adsense Ads Only on Home page or Post pages of WordPress blog

Show ads on Home Page only

put your ads code between the red code :

<?php if (is_home()) { ?>
YOUR AD CODE
<?php } ?> 


Show ads on Individual Posts Page only

put your ads code between the red code :

<?php if (is_single()) { ?>
YOUR AD CODE
<?php } ?>
  

1 Comment:

Unknown said...

I'm using adsense within my posts. (ads look blended in with the post content) .
The ads are shown in top left corner with the post, top right corner of the post content.
My problem is, when i go to the blog's homepage. Post ads are also shown there (only the ads above !--more-- tag). since google doesn't allow more than 3 content ads per page, we can't allow this.

So i want to show these ads only in post pages but need to hide those in the home page.

I've tried using

< ?php if (!is_home()) : ?>
--- adsense code goes here ---


but the post now shows

< ?php if (!is_home()) : ?>



tags before showing the content. This means this php tags doesn't work.
I'm NOT using a static page for the homepage. homepage is a combination of the latest posts.

see http://www.verilog.asia

Thanks

Post a Comment