Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

How to show Adsense Ads Automatically between title and description 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.
<!-- Adsence code between title and description   -->
<div id='middle-ad'>
  
<data:post.body/>

          </div>

<b:if cond='data:blog.pageType == &quot;item&quot;'>

<style>
#addcodemiddle{display: none;}
</style>
<div id='addcodemiddle'>

    </div>  

<script type='text/javascript'>


var str1=document.getElementById(&quot;jobmiddlenew&quot;).innerHTML;
var str2=str1.length;
var str3=str2/2;
var substr = str1.substring(str3, str2);

var n = substr.search(&quot;&lt;br&gt;&quot;);
if(n&lt;0)
{
n = substr.indexOf('.');
if(n&lt;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=&quot;<center>&quot;+document.getElementById(&quot;addcodemiddle&quot;).innerHTML+&quot;</center><br/>&quot;;

var newbody=firsthalf+addcode+secondhalf;


var strnew=document.getElementsByClassName(&quot;post-body entry-content&quot;);
strnew[0].innerHTML=newbody;

document.getElementById(&quot;addcodemiddle&quot;).innerHTML=&quot;&quot;;
      
</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.

Comments

Popular posts from this blog

PostgreSQL application_name (string)

VMWARE WORKSTATION 3,4,5,6,7,8,9,10,11,12,14,15...etc LICENSE KEYS COLLECTION

Postgres Streaming Replication Configuration

How to find the server is whether standby (slave) or primary(master) in Postgresql replication ?

Postgres Database Patch