If you are a blogger and have recently got approved for Google AdSense; you will surely look out for integrating the AdSense code in your blog. While it is straightforward to copy and paste the codes in HTML websites where you want the ads to appear, it becomes a difficult task if you are using WordPress. Especially because there are a lot of choices – you can switch to a theme which has support for AdSense Integration, add a plugin, use widgets or change the PHP codes. Though there are choices, it is quite confusing to decide one and that may not really fulfill the requirements you may have. For example, if you want to place the ads inside the blog post below the titles, you probably need to manually do some tweaking.
In this article, I am going to explain about the various ways to add AdSense to your WordPress blog. It includes adding AdSense without plug-ins.
Let’s start with the simplest first.
Add AdSense with text widget
Yes, you can use the text widget available in WordPress to insert the AdSense codes. It’s really the simplest way to do this without using plugins. You also get the flexibility to place add in various parts of your web page like heading, sidebars, or bottoms depending on your theme. Most of the themes now support placing the custom text box in various parts of web page. Here is the step-by-step method to implement AdSense with text widgets.
- Log in to your WordPress blog (you must be the administrator).
- In the left side menus, go to appearance and select widgets.
- Depending on your theme, you will have various sections of the blog where you can insert the widgets like sidebars, colophon, top widget, etc.
- Add the text widget by dragging it to the section where you wish your add to appear.
- Now edit this widget and paste the AdSense Code.
- Save changes and you are done.
You can put a caption for the text widget here but I recommend you leave it blank. If you put something like “useful links” or “click here”; Google may find it the violation of AdSense terms and conditions. You should decide the placement of text widget in any particular section based on the width and height of ad unit. You will definitely not put a skyscraper in heading section! Here is a screenshot for your assistance.
Using a WordPress plugin to add AdSense
There are many plugins which allow you to integrate AdSense in WordPress. At the same time, these plugins allow you to choose the ad size, color scheme, format, number of ad units and the place where you want the ads to appear. If you have any specific choice, you can search Google for getting just the right WordPress plugin for you. Here, I am listing down the four popular and tried out plugins which will nicely do most of your work.
WordPress Themes for AdSense
There are many WordPress Themes available which are specially designed and optimized for Google AdSense. These themes help you for placing ads at the most important places which may increase your CTR. While these themes have tall claims, it may not necessarily improve the CTR or your earnings. If you don’t like to experiment and have big pocket to spend money for a premium AdSense theme; go ahead and search Google. You will find plenty there.
But for those having tight budgets, my recommendation is that you try either with your existing theme or get a good free theme and try placing ads at different sections. There are many suggestions about placement but there is no thumb rule. You have to find the most valuable place by experimenting yourself.
Modifying the PHP codes to insert AdSense Code
Although it may seem a little difficult task; it gives you the real flexibility to place you add exactly where you want. In this website, I use this method for ad placement. For example, if you want to display a rectangular ad unit just below the article heading inside the blog like I do (it is apparently the ad unit with highest CTR); it is highly recommended to use this method.
And don’t worry about the difficulty of editing codes. I will explain you step by step method to edit the PHP code and place the ad unit. It will be really easy and you don’t require knowing anything about PHP.
- The first thing you need to do is to log in to your WordPress blog as an administrator
- Go to Appearance and click Editor
- By default, Stylesheet (style.css) is displayed in editing window.
- From the list of Templates, search ‘Single Post’. Click to edit the PHP code of Single Post (single.php).
- We are going to make changes in this PHP file. So, it is better to take back-up in case there is some goof-up. So select and copy the PHP code (ctrl+A and ctrl+C) and paste it in a notepad. Save it and your backup is ready.
- Look out for code something like this:
<div> or <div class=”postcontent”>. This line of code is for the beginning of the main content. We need to place the AdSense code just below this line.
- Before placing our AdSense code, let’s create a space which is left aligned and has some margin from the main content.
<div style=”float:left; margin:10px”> </div>
- Now we can place our AdSense code inside this <div>. Your code along with this <div> should similar to this:
Great! Press the update button below the editor window to save the changes you have just made. You should see the AdSense add live on your blog!