22 March 2010

How to Show Adsense Ads Only on Homepage or Post pages on Blogger

Advertisements

Now that you have learned how to place adsense ads in between your blog posts some of you may want to show adsense ads only on blog homepage or blog post page only. Here is a easy trick to do this.

Go to Dashboard > Layout > Edit HTML > Expand Widget Templates.

To show ads on homepage only,

If you want to add your ads after post title but only show in homepage

&lt;div class='post-header-line-1'/&gt; <br>
&lt;div class='post-body entry-content'&gt; <br>
&lt;b:if cond='data:blog.pageType != &amp;quot;item&amp;quot;'&gt;<br>
<b><span style="color: red;">

YOUR ADVERTISEMENT CODE

span>b><br>
&lt;/b:if&gt; <br>

<br>
&lt;p&gt;&lt;data:post.body/&gt;&lt;/p&gt;<br>
<br>
&lt;div style='clear: both;'/&gt; <br>
&lt;!– clear for photos floats –&gt; &lt;/div&gt;

Show ads on blog posts only, modify your code like this :

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

YOUR ADVERTISEMENT CODE

</b:if>

UPDATE
Here is another solution I found

Get your adsense code and paste it to Notepad. Now remove the line breaks and comments from the Adsense code. Do not modify the ad script. It should look like:

[adsense.JPG]

Now add this code using this code.

<b:if cond ='data:blog.pageType == "item"'>

    YOUR AD CODE HERE

    </b:if>



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

Related Posts

Post a Comment

Share

Twitter Delicious Facebook Digg Stumbleupon Favorites More