Last active
October 25, 2022 08:35
-
-
Save vinayprajapati/5893386 to your computer and use it in GitHub Desktop.
Adsense in Middle of Post: Blogger - Advanced Practices (Part 2)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Copyright 2013 by AJ Banda + Vinay Prajapati | |
//http://www.techprevue.com/2013/06/adsense-in-middle-of-post-blogger_30.html | |
//1. Below <head> place this | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js" ></script> | |
//2. Replace <data:post.body/> with the following code | |
<div id="PostBody"> | |
<data:post.body/> | |
</div> | |
<div id="AdCode"> | |
<div style='margin:5px 0;text-align:center;clear:both;'> | |
<!-- Ad Unit Code Here --> | |
</div> | |
</div> | |
//3. Now just before </body> tag paste following js | |
<b:if cond='data:blog.pageType == "item"'> | |
<script> | |
$AdCode = $("#AdCode").html(); | |
$("#PostBody br:lt(1)").replaceWith($AdCode); | |
$("#AdCode").remove(); | |
</script> | |
</b:if> | |
//4. Save template :D | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Great, I've used it on my website and it works great yalla shoot smart