File Size: Explanation of the site - File Extension: None - Placing Adsense ads in the middle of posts for Blogger blogs
In the name of Allah, the Most Gracious, the Most Merciful
In this post, we will learn how to automatically place Google Adsense ads in the middle of your posts without any manual intervention.
First, before doing anything, make sure to back up your template.
Step One
Search for this tag <data:post.body/> and you will find three instances; choose the last one.
Step Two
Replace the previous code with the following code.
<div expr:id='"zet1" + data:post.id'/>
<div class='googlezet'>
<!-- ad code goes right here -->
</div>
<div expr:id='"zet2" + data:post.id'>
<p>
<data:post.body/>
</p>
</div>
<script type='text/javascript'>
var obj0=document.getElementById("zet1<data:post.id/>");var obj1=document.getElementById("zet2<data:post.id/>");var s=obj1.innerHTML;var t=s.substr(0,s.length/2);var r=t.lastIndexOf("<br>");if(r>0) {obj0.innerHTML=s.substr(0,r);obj1.innerHTML=s.substr(r+16);}
</script>
Step Three
Now, all you need to do is replace the highlighted yellow text in the previous code with your Adsense ad code. Just go to your account and select the code you want to display to your followers in the middle of the post for all posts. Don't forget to convert your Adsense ad code using the Adsense code converter to ensure compatibility with the template language.
Step Four
Now, here is the CSS code that will create space above and below the ad to avoid confusion between the text and the ad.
Search for this code.
]]></b:skin>
And place the following code directly above it.
Copy this code and place it above the previous code.
.googlezet{margin:15px auto;text-align:center}
The End
And with that, you have successfully added Google Adsense ads in the middle of all previous and future posts. You will find that Adsense ads have appeared in the middle of your previous posts as well.




