How to place Adsense code in your blog’s posts

If you are a webmaster or a blogger you know that one of the first things to use to get some money is Google Adsense code.  Placing the code in your posts’ content is really easy because all you have to do is perform a simple copy-and-paste. That’s it. From now on Adsense will run on your website. The story changes completely when you decide to place the code not as-it-comes, but in the way you want. As a matter of fact, you may decide to place it at the right or left side of your articles, or you may want to add something next to it to blend the ads smoothly with your blog’s content. One of the best alternatives around is to use plugins which help you place Adsense in a lot of ways. If instead you don’t want to use them because they tend to burden the server and slow your website down, here are a couple of solutions that help you place Adsense wherever you want and in the most customizable way.
1) Use DIV tags
This method lets you place Google Adsense at the right or left side of your posts by using DIV tags.
  1. First of all, place this code in the style.css (stylesheet) file of your theme: .adsense {float:right; margin-left: 5px;}
  2. Now, go to your Single.PHP (Single) of your theme, look for (of course you can place the following code wherever you want. Just experiment with it) and add this code right before it:
  3. Place your Adsense code here
A little note as far as the first piece of code I provided namely : .adsense {float:right; margin-left: 5px;}. Basically it says to Adsense to go to the right part of the article and stay away from its content of 5px starting from the left margin of the ads generated by the code. Here is a picture that explains what I mean.

2) Use Html Table
This method is more versatile in my opinion, because it lets you decide how to place Adsense ads wherever you want by using a series of parameters which give you complete control over the positioning of the ads.
  1. Go to your Single.PHP (Single) of your theme, look for (of course you can place the following code wherever you want. Just experiment with it) and add this code right before it:

insert your adsense code here

A little note as far as the first piece of code I provided. It creates a table of just one cell. The content of the table will be aligned to the right. Here are other parameters you can play with:
  1. Border. This creates a visible border that will let you see the table. The higher the namer you assign to the attribute the ticker the border is. Of course if you don’t add this attribute to the table, the border will be invisible. Ex. border=”4″
  2. Cellpadding. This creates a space between cell walls and contents (pixel). Ex. cellpadding=”8″
  3. Cellspacing. This creates a space between cells (pixel). Ex. cellspacing=”6″
Here is a simple example. I have created a table composed by two cells.


Insert your Adsense code here.

Insert your content here.
Here is the result:
Insert your content here. Insert your Adsense code here.

0 comments:

There was an error in this gadget

Ads By Google