How to Put Adsense Ads Inline With your WordPress Posts

by mitz on February 7, 2010

Building websites with WordPress is easy until you have to start editing the code behind the website. However this is necessary in order to add AdSense code into your posts as it lines it up nicely.  This means it will automatically be added to every post you create in your WordPress website. If you add AdSense into your templates you will not have to touch it again and the less you play with the code of your website, the better. I will show you how to add AdSense to your posts so it will line up with the text, embed itself, and look like it is meant to be there.

    1. Sign into your WordPress Admin area.
    2. Click on the Appearance menu.
    3. Then click on Editor. See the screenshot below.

appearnac-editor

    1. You will be taken to the WordPress code editor. Click on Single.php in the right column.  See the screenshot below.

appearnac-editor2

  1. When the single.php code shows up you can copy all of it and paste it to a notepad, just in case you stuff something up. This is very important. Do not move any text or even add a space where it is not meant to be. Just copy it and make a quick backup of the code. You can press in the code box and then press CTRL + A to select all. Then right click on the selection to choose copy.
  2. Ok after you have backed up this code we can now add something to it.  Look for where the content begins. The code will look something like this <div class=”postcontent”>
  3. We are going to add our code before this.
  4. Here’s the code
    • <div style=”display:block;float:left;padding:5px;”><add your adsense code here></div>        


appearnac-editor3

Sometimes you might need to put <p> and </p> tags to make a paragraph around all of this. It really depends what WordPress theme you are using. As you can see in the screenshot above, I have used the <p> tag. On some websites I do not have to.

When you are finished adding your AdSense code in press on the update button below the code window.

If you have backed up your code you can keep adjusting this until you get it right. Then if you can’t work it out, just paste the original code back in and press on update to save. When playing with the WordPress code editor make sure you are not cutting code when you are meant to be copying it…Anyway you shouldn’t have to worry if you make a backup.

Related posts:

Related Posts

This post was written by...

– who has written 187 posts on Wordpress Website builder.

I am addicted to internet marketing and making money online. Who wouldn't want to live that life? I started out with one website as a hobby and now have over 20. Come and join in the fun and share your knowledge about building Wordpress Websites. If you are interested in guest posting for this website click here to see more details.

Submit your own guest post now!

{ 19 comments… read them below or add one }

Madhav Tripathi December 12, 2011 at 6:04 pm

Thanks for this tips, this works like charm on my bookmarking website. The idea of implementing style with div tag is great.
Madhav Tripathi recently posted..What to do if Add-ons are disabled after updating Firefox?

Reply

Kharim from Make Money Blogging November 30, 2011 at 6:24 am

Not bad. What I usually do is get a plugin to do it for me. Quick Adsense is the name of the plugin.

Its really great to use.
Kharim recently posted..CommentLuv Premium – One Of The Best Thing That Happened To This Blog

Reply

onthelash October 20, 2011 at 5:08 am

Under Appearance, I don;t have the Editor Tab?? Using Bueno Theme by Woothemes. Anyone here who could possibly help? Thanks!

Reply

mitz October 20, 2011 at 6:35 am

Maybe woo themes has its own place to put adsense?? Not sure though as I don’t use them?? You could try the Woo themes website for support.. :)

Reply

Marks from Blogger Network October 5, 2011 at 9:28 am

Nice tricks! we can also insert adsense ads into the post using “post layout” plugin.
Marks recently posted..Building Link Popularity For Blog

Reply

Amaryder September 28, 2011 at 4:37 pm

nope actually i did n’t find ur code
on my Single.php file so how can i add further codes so plzz help me out Shall i provide my Single.php codes here so tht u can modify them!

Reply

Amaryder September 28, 2011 at 3:54 am

i did n’t find this code in my SIngle.php file and by putting your Given Code I get ads Below post title not in between post contents please help me Out!

Reply

mitz September 28, 2011 at 9:50 am

So did you did you add the padding code or just the adsense code?

Reply

Danny Strampel September 9, 2011 at 2:09 pm

Never thought about it. plugins will slow my site down. I should start to look into learning some more code.
Great insight Mitz!
Danny Strampel recently posted..Remington RM1015P 10-Inch 8 Amp Electric Pole chain Saw

Reply

best hcg drops September 6, 2011 at 11:46 pm

I have been using the wordpress plugin called WhyDoWork Adsense for a couple years now and it’s worked great for me. It allows you to put Adsense code (or any other ad code from other networks) into your posts.

Reply

mitz September 7, 2011 at 10:42 am

Hi Paul
Thanks for the great tips…Can you please use your name@keyword as I am starting to ban anyone that does not do this…We like to know who we are talking to..

Reply

Anthony August 25, 2011 at 6:08 pm

There are a lot of free plugins that set this up nicely if I recall. I’m not going to play favorites, but a general search for adsense on the plugin list can find you a winner. If there’s a plugin I can add to do something, I refuse to run the risk of fouling up code.
Anthony recently posted..Acne Diets-Let’s Get Real

Reply

mitz August 26, 2011 at 8:56 am

Ah yes but in the end it is better to add the code because too many plugins slow your site down… I use the plugins until I can figure out how to do something myself.

Reply

kebabope June 26, 2010 at 11:57 am

Hi Mitz,
Thank you very much for sharing,it was helpful.

Cheers,
Kebabope Morapedi
kebabope recently posted..Attraction Marketing,Is It Worth The Trouble?

Reply

Alex June 22, 2010 at 5:42 pm

At me this isn’t working. I don’t have the add theme option. Can you help me?

Reply

wakarima June 17, 2010 at 2:33 am

i have a blogroll account and i have reason to believe it is similar to wordpress or related but i just can’t seem to find where i can add adsense, a little help?
wakarima recently posted..a list of things i hate

Reply

mitz June 17, 2010 at 3:52 am

If it is a free wordpress blog then you cannot add adsense like this…I don’t think you can anyway, unless things have changed.. This is for people who have installed Wordpress on their own server or hosting.

Reply

Linwood Winski June 8, 2010 at 1:15 pm

That is such a good resource you are offering and you’re giving it away for free. I honestly appreciate seeing sites that comprehend the value of providing a useful resource for absolutely free. I genuinely enjoyed reading through your post :) Thank you

Reply

Quinn Hoffee June 5, 2010 at 12:02 am

I’ve been following your blog for 2 days now and I should tell you I get tons benefits from your post. and now how I can get news update from your website?

Reply

Leave a Comment

Please use your REAL NAME@KEYWORDS or just your REAL NAME to get approved. Worthless generic comments will be deleted. Please see these tips on how to get approved.

{ 1 trackback }

Previous post:

Next post: