'Show multiple ads in middle of article post in blogger with shortcodes
I want to show ads on blogger posts using shortcodes. With the help of shortcode, I can add multiple ads like 4 to 5 ads in the blogger post. But I don't know how to do this.
Here some methods are avilable on the internet in which we can add 2 to 3 ads only. This is the code
<div expr:id='"adsmiddle1" + data:post.id'></div>
<b:if cond='data:blog.pageType == "item"'>
<b:if cond='data:blog.pageType != "static_page"'>
<div style="clear:both; margin:10px 0">
<!-- Add here the code of your ad -->
</div>
</b:if>
</b:if>
<div expr:id='"adsmiddle2" + data:post.id'>
<data:post.body/>
</div>
<script type="text/javascript">
var obj0=document.getElementById("adsmiddle1<data:post.id/>");
var obj1=document.getElementById("adsmiddle2<data:post.id/>");
var s=obj1.innerHTML;
var r=s.search(/\x3C!-- adsense --\x3E/igm);
if(r>0) {obj0.innerHTML=s.substr(0,r);obj1.innerHTML=s.substr(r+16);}
</script>
Using the above code we can add Adsense ads code only by 2 times in blogger post by this shortcodes <!-- adsense --> but I want to modify it for multiple Adsense placement.
Anyone please help me.
Solution 1:[1]
<b:loop values='data:widgets.AdSense' var='AdSense'>
<data:AdSense.title/>
<data:AdSense.type/>
<data:AdSense.sectionId/>
<data:AdSense.id/>
</b:loop>
source: https://www.thoughtco.com/add-adsense-to-blogger-1616427
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | therkut |
