Adsense in Middle of Post: Blogger - Advanced Practices (Part 2)
//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 | |
This comment has been minimized.
This comment has been minimized.
You need to use a code of a sync ad, not an async one. It works in my site: https://frenegeek.com |
This comment has been minimized.
This comment has been minimized.
Me too, do you solution show one ads?. i want show in https://choluoi.com |
This comment has been minimized.
This comment has been minimized.
I made a pure Js function similar to this, Check this out: https://github.com/ajaymalik14/place-ad-inside-article-usign-pure-JS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
It is showing two ads in my post. I just want to show one