How to add AdSense Code to the middle of every Blog Post within 5 minutes, automatically!
Today I’ll be posting a step by step guy on how to add Inline AdSense code to the middle of your blog posts. Not only AdSense, but you can use this for Yahoo! Publisher Network ads, Bidvertiser and etc. We’ll be going through all the details and utilizing a plugin, and a simple theme hack to complete the trick which will add AdSense block within all your blog posts, published already and to be be published.
But, first of all, why would you want to add inline AdSense Code? Because that improves your AdSense Ad block visibility. You blog post will wrap around the Inline AdSense slot, so that’ll make sure a good number of your visitors reading the post will ultimately see the Ad - instantly boosting your AdSense CTR…
Ready? Here we go… We will insert a blog of AdSense code to everyone of your posts, making the post wrap around the block, to the top left corner. (I’ll show you how to customize this later in the post)
The Method - Adding AdSense code
1. Copy your AdSense code and keep it in the clipboard.
2. Open your wordpress theme editor and open the Single Post Template (single.php) or whichever the template file for your Single Posts. (We’ll add AdSense only to the individual posts)
3. Then find the line of code which says:
<?php the_content(’Read the rest of this entry »’); ?>
4. Got it? Awesome! Now, right before this code, insert a new line and type out the following coding. Replace <your AdSense code here> with your AdSense code. (A screen shot is given below)
<div style=”float:left;”><your AdSense code here></div>
5. Update your theme changes! And you’re done with adding the AdSense code.
Now, you must be able to see an AdSense code being placed Inline with all your posts to the top left corner.
How to customize the position?
Simple. First, you must understand a few things.
One, the php code you hunted down: “<?php the_content(’Read the rest of this entry »’); ?>” - resembles the function which will call your blog posts’ text. Not the header, just the text and the body content i.e. Images and etc. So, if you insert the AdSense code after this line, unlike the previous example, you should see the AdSense block after each post.
Two, in the Div Container code: “<div style=”float:left;”><your AdSense code here></div>” - “float: left;” means that you’d align the AdSense block to the left of the post. To make it align to the opposite end, just replace it with “float: right;”.
So, there you go. I hope you’ll find this useful. If there’s anything you’d like to know or clarify, just shoot me a message.










It isnt working
http://ourgym.co.uk I put it in exactly as you said but nothing shows, not even a gap 
Hmmm.. That is very unlikely. I’m sure this should work since I followed the exact same steps for one of my other blogs yesterday. Are you using any cache plugins on our gym?
Wow !!! I never thought about this
Thanks for sharing .. that will surely can increase potential of earnings via adsense ..
Cheers
I don’t know if I am or not. I am going to test it again…. may even be the server cache
No, tested and it definitely isnt showing
I would love this but I think Im not having it LOL
Hmm.. Can’t think of a logical reason as to why. If you can send me the edited single.php file I can take a look.
I heard somewhere that Google only allow 3 AdSense blocks per page. Is that what causing you this problem?
Yes, that’s true. AdSense only allows three blocks per page. But this was a simple misplacement in her file. And it works fine for her now.
Thanks for the very informative tips…I always wondering how the other blogger position the adsense in the middle of posting.
Ah.. .I wish I know this tutorial before getting depress managing my Single.php code.wahaha U did amazing jobs in writing tutorial.I already able to put the adsense code at my post. But since I use small view to post, I put it on top ^^
I knew this tip from long time. was also using it when i was using blogger platform… But it is a very important thing to do if you want to get good CTR Rate.
Hi Nadeesha
thanx for the great tips i am not using any advertising service at the moment on my blog
but i will surely use your trick when i use one
What if I want to align it in the middle of the post. Not in the beginning, not end.
Hey that’s great, but what about actually adding it to the middle of the post
EI Half way down the text of the post? I’d like to try adding an extra adsense bloc their
DO you have to create various loops or something?
Thanks
Jayen
Hmm.. the easiest way to do that is to develop a plugin that insert adsense code automatically after a X number of words, breaking the paragraphs..
I’ve been looking for a plugin for it but so far no luck
Still for now i applied your method, i had to learn a little CSS to get it to wrap around the text thou, i ended up editing it like this:
That works well
Now to tidy it up and put it in my style sheet.
Thanks for the post, i’ve sub to your feed
i’d been meaning to figure out how to do this for a while.
Jayen