How to Display Adsense Ads within Blogger Posts (Not in the End)

In the beginning you need to enable Ads in the post by going to layout and edit the Blog Posts. Here you will get an option "Show Ads between Posts". Enable it and choose the size of Ads.

By using this simple technique the ads are displayed at the end of posts, and between first three posts on the homepage. But what if you don't want to display them on homepage or don't want to display them at the end of post, but in the starting of post.


To do these things now you have to edit the template code. Before you take that step please take backup of your template code and then apply the trick that i have mentioned below.

You have to find the blogger Ad code. Find the code given below in your template coding. Cut it and paste it in a separate notepad file.

Adcode:

<b:if cond='data:post.includeAd'>
        <b:if cond='data:post.isFirstPost'>
          <data:defaultAdEnd/>
        <b:else/>
          <data:adEnd/>
        </b:if>
        <div class='inline-ad'>
          <data:adCode/>
        </div>
        <data:adStart/>
      </b:if>



Find     <b:loop values='data:posts' var='post'>

And paste the above adcode just below it.

If you want to display the ads on a side of main content of the post, then put the adcode within the div provided below.

<div style='float:left'>
<!-- AdCode Here -->
</div>

Here style='float:left' will put the ad on the left side of main post content. You can also set it to right if you desire so.

If you want to display Ads only in Posts, not on the homepage. Then put the code within the if loop provided below.

<b:if cond='data:blog.pageType == &quot;item&quot;'>
<!-- AdCode Here -->
</b:if>

If you implement all things explained above then your code will look like this

<b:loop values='data:posts' var='post'>
<b:if cond='data:blog.pageType == &quot;item&quot;'>
<div style='float:left'>
      <b:if cond='data:post.includeAd'>
        <b:if cond='data:post.isFirstPost'>
          <data:defaultAdEnd/>
        <b:else/>
          <data:adEnd/>
        </b:if>
        <div class='inline-ad'>
          <data:adCode/>
        </div>
        <data:adStart/>
      </b:if>
</div>
</b:if>
Share this Article :
Email

No comments:

Post a Comment