I want to say, this is about breakthrough method for blogspot fans to cover the shortfall with the rival wordpress. Indeed, there are somethings good and the other side any something less. Blogspot does not allow you to manage the database and php scripts. Using javascript allow you to fulfill your desire to place an adsense ads automatically in the middle of the content paragraph in the overall post that you have made by replacing space between content paragraph by your adsense ads.
As fans of blogger now you can breath, because you can place adsense ads in the middle of content posts. Ok let us begin how to apply it into your blog.
1. Firstly, make sure you have included the jquery library script 'jquery.min.js' in your template. May be have different version of jquery.min.js, no problem. Go to the dashboard, click template>edit html. In the script of the template, press Ctrl+F as usual to find any code faster, type min.js. you may find 'jquery.min.js' script link in the head of the template like this.
<script src='http://agratitudesign.googlecode.com/svn/trunk/jquery-1.7.min.js' type='text/javascript'/>
If you do not have jquery min.js on your template, just copy the script link jquery min.js above, put before </head>. In this case i've place below </style>. Let see the picture above!
2. Insert the following javascript just before the body tag end. Before you place, change it with the parse code at first. For more easier just put above the </body>. The script will identify any space contained in the content posts that marked with <br/> and replace it with an adsense ads of yours.
<script>
$addThisCode = $("#addThisCode").html();
$("#mainPostContent br:lt(1)").replaceWith("<br/>" + $addThisCode + "<br/>");
$("#addThisCode").remove();
</script>
$addThisCode = $("#addThisCode").html();
$("#mainPostContent br:lt(1)").replaceWith("<br/>" + $addThisCode + "<br/>");
$("#addThisCode").remove();
</script>
As the picture above this script is comment to replace <br/> with adsense ads, you can change a variable inside br:lt(1) to be br:eq(2). From here you can adjust the number and position of your ads in the content paragraph.
Description:
br:lt(1): means that you will change the first space or <br/> just one, so the adsense ads will appear once in the full view of the content posts, by searching where is the first space on every posts that you have made. Usually we use the space by enter to make paragraph separator. If you use br:lt (2), it means ads will appear 2 times, replace first and second <br/>.
br:eq(2) means that you will determine just one ads that appear on the second space of post content. If use br:eq(3), it means the ads will appear only once on the third space <br/>.
3. Insert the script below that icluded adsense ads code into the data post body.
Ctrl+F and type <data:post.body/>, then replace the script below! and yet parse of your adsense ads code and replace <!--PLACE ADSENSE CODE HERE-->
<div id="mainPostContent"> <data:post.body/> </div> <div id="addThisCode"> <!--PLACE ADSENSE CODE HERE--> </div>
The cause of the failure is usually pointed here, that is the wrong choose <data:post.body/> to be replaced. A long as my experience this is going to be the problem, see the left picture below! there are three <data:post.body/> on the first group that makes failed. In fact there are any <data:post.body/> group again at the bottom on my template, I was replaced the first <data:post.body/> in group 2. The result is successful.
4. Come to edit one of the article post, after opened on the right side click option. In the line breaks: Use <br> breaks. Automatically the existing space in each posts that you have made in the html code is replaced with <br/> of the whole content posts.
The next, you will see the display adsense ads in full view on every post articles. For more details, let's see the above article video! have a nice day!
Related Articles
The information on this blog is very useful and very interesting. If someone needs to know about the just click .
ReplyDeleteComputers & Printer Services in Georgia | Computers Repair Services in Georgia
Thank for your sharing good blog comment.
ReplyDeleteหนังใหม่
Thank you very much... this code running & success for my Blog
ReplyDeletethanks for your information. the code worked fine on my blog: www.sportspva.com
ReplyDeleteyou have done a great job I hope you will do much batter in the future. Please coming site tiktok downloader to know more information
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThank You for sharing the valuable content. Looking for casino game to start playing for free? Then you can find the list of free online casino games win real money no deposit in India. For more queries, visit: https://winonlinecasino.in/
ReplyDelete