How To Place Adsense Ads In Middle of The Post in Blogger
Blogging tricks in urdu book
Place Adsense Ads Automatically In Middle of All The Posts In Blogger:
Follow The below process to place adsense ads in Middle of all the posts automatically in blogger.
Step 1:
Login to Your Blogger Account
Go to Template >Edit HTML
Step 2:
Search For Below Code in your template.
<data:post.body/>
You will get multiple codes similar to above code. You have to select the second code which is similar to above code in order to make the script work properly.
Step 3:
Replace The above Code With The Below Code.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
<div id='jobmiddlenew'>
<data:post.body/>
</div>
<b:if cond='data:blog.pageType == "item"'>
<style>
#addcodemiddle{display: none;}
</style>
<div id='addcodemiddle'>
Place Your Ad Code Here
</div>
<script type='text/javascript'>
var str1=document.getElementById("jobmiddlenew").innerHTML;
var str2=str1.length;
var str3=str2/2;
var substr = str1.substring(str3, str2);
var n = substr.search("<br>");
if(n<0)
{
n = substr.indexOf('.');
if(n<0)
{
n=0;
}
var firsthalf = str1.substring(0, str3+n+1);
var secondhalf = str1.substring(str3+n+1, str2);
}
else
{
var firsthalf = str1.substring(0, str3+n+4);
var secondhalf = str1.substring(str3+n+4, str2);
}
var addcode="<center>"+document.getElementById("addcodemiddle").innerHTML+"</center><br/>";
var newbody=firsthalf+addcode+secondhalf;
var strnew=document.getElementsByClassName("post-body entry-content");
strnew[0].innerHTML=newbody;
document.getElementById("addcodemiddle").innerHTML="";
</script>
</b:if>
|
Step 4
Replace The Place Your Ad Code Text With Your Adsense Ad Code in the above code and save your template.
Post a Comment
Thank for feedback u