How to Place Ads In Center Of Blogger Post

How to Place Ads In Center Of Blogger Post

Updated on 16 May

There are different ways to set your ads between your posts in blogger also provides this functionality to show your ads between posts but what about other ad networks? If you are using any other ad network you can also place that ads between your posts using this code.

So if you want to place your ads between your post you have to follow the steps which are provided below.

Steps to Place Ads in Center Of Post:

  1. Go To Blogger Dashboard
  2. Then Go to Theme / Template
  3. Click Edit HTML Button
  4. Now search for <data:post.body/>
  5. To Search anything in blogger Press Ctrl + F and type or paste the term to search in search bar.
  6. Now Replace the above code with the code provided below.
  7. <div expr:id='"post1" + data:post.id'/>
    <div class='googlepublisherads' style='margin:20px 0'>
    <center>
    Your Ad Code Here
    </center>
    </div>
    <div expr:id='"post2" + data:post.id'><data:post.body/></div>
    <script type='text/javascript'>
    var obj0=document.getElementById("post1<data:post.id/>");
    var obj1=document.getElementById("post2<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+4);}
    </script>
  8. We are all done but if you want to place your in other positions like left or right also have some distance Above and bottom you can use anyone code from below list that you like instead of above code.
  9. How to place ads in the centre of your post:

    <div expr:id='"post1" + data:post.id'/>
    <div class='googlepublisherads' style='margin:20px 0'>
    <center>
    <div style='margin:10px auto'>
    Your Ad Code Here
    </div>
    </center>
    </div>
    <div expr:id='"post2" + data:post.id'><data:post.body/></div>
    <script type='text/javascript'>
    var obj0=document.getElementById("post1<data:post.id/>");
    var obj1=document.getElementById("post2<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+4);}
    </script>

    How to place ad at the Right Side of your post in the centre:

    <div expr:id='"post1" + data:post.id'/>
    <div class='googlepublisherads' style='margin:20px 0'>
    <center>
    <div style='float:right;margin:10px 0 10px 10px'>
    Your Ad Code Here
    </div>
    </center>
    </div>
    <div expr:id='"post2" + data:post.id'><data:post.body/></div>
    <script type='text/javascript'>
    var obj0=document.getElementById("post1<data:post.id/>");
    var obj1=document.getElementById("post2<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+4);}
    </script>

    How to place ad at the Left Side of your post in the centre:

    <div expr:id='"post1" + data:post.id'/>
    <div class='googlepublisherads' style='margin:20px 0'>
    <center>
    <div style='float:left;margin:10px 10px 10px 0'>
    Your Ad Code Here
    </div>
    </center>
    </div>
    <div expr:id='"post2" + data:post.id'><data:post.body/></div>
    <script type='text/javascript'>
    var obj0=document.getElementById("post1<data:post.id/>");
    var obj1=document.getElementById("post2<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+4);}
    </script>
  10. Replace highlighted text eg:(Your Ad Code Here) with your AD code.
  11. You are all done save your template and have a look.

Conclusion:
You are all done now you have to make some changes in the court provided above you have to replace the highlighted text with your ad code.

After you have pasted your ad code then this code with work absolutely fine.
Source: softwebtuts.com

0 comments for How to Place Ads In Center Of Blogger Post

Cancel