WordPress Plugin for Simple Google Adsense Insertion/Integration
Categories: Wordpress Plugin
Easy to use WordPress plugin to insert Google Adsense to your posts, pages and sidebar by using a trigger text or calling the php function.
There are many plugins and services which can add Google Adsense to your WordPress site. However I found that even though something like Adsense Manager or Adsense Deluxe provides a lot of customizable options, it can be overwhelming and isn’t really simple enough for people who are new to WordPress or for people who simply want to insert Google Adsense to their site in a few clicks.
I found that most of the time I only use two or three types of Google Adsense units in various places and posts throughout my sites. Google’s Adsense policy mentions to not have more than three adsense block in one page anyway. That’s why I wrote my own Simple Adsense Insertion Plugin for WordPress, to focus on having 1-3 Google Adsense codes saved and use them where ever I want on my site by inserting a simple trigger text to my posts,pages and sidebar.
Installation
1. Unzip and Upload the folder ‘WP-Simple-Adsense-Insertion’ to the ‘/wp-content/plugins/’ directory.
2. Activate the plugin through the ‘Plugins’ menu in WordPress.
3. Go to Settings and configure the options eg. Copy and paste the Google Adsense code that you want to use.
4. Add the trigger text [wp_ad_camp_1] to a post or page where u want it to appear.
Usage
There are two ways you can use this plugin:
1. Add one of the following shortcodes (trigger text) on a post or page
- [wp_ad_camp_1]
- [wp_ad_camp_2]
- [wp_ad_camp_3]
- [wp_ad_camp_4]
2. Call one of the functions from your theme’s template file:
- <?php echo show_ad_camp_1(); ?>
- <?php echo show_ad_camp_2(); ?>
- <?php echo show_ad_camp_3(); ?>
- <?php echo show_ad_camp_4(); ?>
This Plugin in Action
See this plugin in action on Antique HQ.
Download
Download the Plugin from here.
Donation Option
Donation option can be found on my projects page.
Change Log
- Version 1.1
- Fixed an issue whereby sometimes Google Adsense code were disappearing from the settings page in some WordPress themes.
- Version 1.2
- Devlin from wptheming.com added proper shortcode implementation for placing the ads (this way you don’t have to use the old filtering options anymore)
- Version 1.3
- Added shortcode filtering on sidebar
- Version 1.4
- Added shortcode filtering on widget text and excerpt
Additional Documentation
How to Add Google Adsense to the Sidebar
You can use the shortcodes (example: [wp_ad_camp_1]) in the sidebar to show Google Adsense ad in the sidebar widget. Simply ad a text widget to your sidebar and place the shortcode in there.
Alternatively, you can add Google Adsense on the sidebar using the ‘Simple Adsense Integration’ Plugin by using the following PHP function:
<?php echo show_ad_camp_1(); ?>
If you are calling the function from the theme’s template file (sidebar.php) then you are fine but there is another way to do this using the widgets which could be more practical in some cases.
1. Download and activate the Executable PHP code plugin if you don’t have it already. This plugin lets you call php functions from the widgets (it’s similar to the Text widget but it lets you execute PHP code too).
2. Go to the widgets menu and add a ‘PHP Code’ widget to the sidebar (where you want to display the Google Adsense block). Now add the following line of code and save the settings:
<?php echo show_ad_camp_1(); ?>
This will display an The Google Adesne ad that is saved in the number one textarea of this plugin.
How to Wrap Text Around a Google Adsense Block
To left align the Adsense block and wrap text around it just use the following div for the Adsense unit in HTML view:
<div style=”float: left;”>
Adsense Goes Here
</div>
To right align the Adsense block and wrap text just change “float: left;” to “float: right;”. So for an example, the following will left align the Adsense Unit that is saved in the Ad Campaign 1 box and wrap text around it.
<div style=”float: left;”>
[wp_ad_camp_1]
</div>
If you need help with this plugin or want to suggest an enhancement/feature then please let me know by leaving a comment in the comment area below.
Also, checkout the list of best WordPress plugins to find out what other plugins you should be using.
Articles you may also like:









#1 by James Martell@ Affiliate Marketing Training on August 25, 2010 - 7:14 pm
Yes, exceptionally good plugin. I have recommended it often. A great little tutorial as well. Do you have a plans to offer up a video tutorial as well?
James
.-= James Martell@ Affiliate Marketing Training´s last blog ..Is Google AdSense A Poor Second Cousin To Affiliate Programs =-.
#2 by Norm on August 6, 2010 - 12:39 pm
Great plugin. Simple and effective. Thanks.
.-= Norm ´s last blog ..Grizzly Cub on Highway Shoulder =-.
#3 by mapo on July 17, 2010 - 8:13 am
There are many ways to use Ad Sense to achieve your goals.Some people are using Ad Sense to earn a great deal of money in amounts that you would not have thought was possible unless you robbed a bank.
#4 by cocker on July 14, 2010 - 8:59 pm
Thanks for your plugin. Although you have created it to use adsense, it is also a good tool for using javascript in wordpress. Thanks.
#5 by Amanda on July 10, 2010 - 2:14 am
Hi admin,
Thank you so very much for this plugin.
I tried the most highly recommended plugin for Adsense (I won’t name it) and although it inserted the Googe Adsense ad in my sidebar, it also inserted certain other non-Google advertising badges at the beginning of my posts! Grrr!
I deactivated it and found this one. It was a snack to use and your How-To instructions on this post are really clear and easy to follow.
Thanks again for making this process painless.
.-= Amanda´s last blog ..Get Published Without An Agent Read Emma Michaels’ Amazing Story =-.
#6 by Umesh on June 14, 2010 - 7:37 am
This is great help for beginners. I still remember I spent whole day to figure it out where to put google adsense to display on my blog.
.-= Umesh´s last blog ..Choosing an Exposure Mode : Aperture Priority and Shutter Priority =-.
#7 by Kay on June 2, 2010 - 4:57 pm
Hi I like the clean theme of your site, the design and the ad location. I am a newbie- any tips you could give me would be much appreciated. Thanks.
kayblogger
.-= Kay´s last blog ..Free Themes and Templates =-.
#8 by Umesh on May 29, 2010 - 2:57 pm
Great plugin. Thanks.
.-= Umesh´s last blog ..What is bokeh effect in photography? =-.
#9 by Pablo Jose Acuna on May 26, 2010 - 7:55 pm
Thank you for plugin !!!!
is very, very simple and useful.
Best regards
.-= Pablo Jose Acuna´s last blog ..Presencia en Cibersale =-.
#10 by Rock Ballads CD on May 25, 2010 - 5:52 am
One thorough info I have found on this topic on the net. in order to be back soon to follow-up.
#11 by admin on May 22, 2010 - 8:55 am
The plugin will work fine on WordPress 2.9.2
#12 by Ardiawan.com on May 22, 2010 - 6:16 am
why you don’t upgrade this plugin so it’s can compatible with wordpress 2.9.2 ??
great plugin, it’s very useful
Thanks
#13 by Umesh on May 10, 2010 - 12:35 am
Thanks for the plug-ins. Plug-ins make life easy and do think about content of the page rather than programming.
You guys rock!!!
.-= Umesh´s last blog ..Using Filters with Digital Camera =-.
#14 by Richard on May 3, 2010 - 7:39 pm
This plug-in definitely has some merit for AdSense insertion. However, since you have to do PHP anyway, why not just add the AdSense code to your template pages and not have to deal with a plugin. Of course, this is my thinking but it takes a pretty good knowledge of your template.
.-= Richard´s last blog ..Earn $1000 An Hour With AdSense: Massive AdSense Success! =-.
#15 by Lynn on April 3, 2010 - 6:12 pm
This is great. I couldn’t figure out how to add an adsense block at the top of a main page (in an Artisteer theme) without causing the sidebar to drop down. With this plugin, all I had to do was add a blank sticky post with the code inside. Presto! A large rectangle adsense block at the top of the main page, and the sidebar still in the right position. Thanks for a tremendously useful plugin.
.-= Lynn´s last blog .. =-.
#16 by aidicard on April 1, 2010 - 2:09 am
I’ve been rebuild my blog and this plugin is would be great to use… thanks
.-= aidicard´s last blog ..BEGINNERS GUIDE TO BLOGGING =-.
#17 by Il Bigliettaio on March 18, 2010 - 7:27 pm
There is the way to add more then three Ad Campaign?
Thanks
.-= Il Bigliettaio´s last blog ..Tutti i concerti gli U2 in Italia dal 1987 ad oggi =-.
#18 by Oualid on March 9, 2010 - 4:54 pm
Thank you for the great plugin , i’m using it and fully satisfied
#19 by xmizanx on March 7, 2010 - 2:17 am
thanks for that info… it is really works and awesome
.-= xmizanx´s last blog ..Japanese home-made electric cars revealed =-.
#20 by Cheryl on March 5, 2010 - 6:43 pm
Well! If you look on the left side of the WordPress page, down at the bottom under “Settings”, ya see what I’ve been reading about here! I am SO sorry and feel a little silly, but I hope everybody else can find this more quickly than I did.
THANK YOU!
.-= Cheryl´s last blog ..Multilevel Marketing is Here to Stay =-.
#21 by Cheryl on March 5, 2010 - 6:41 pm
Hi! From what I’ve read here, this is a super plugin that I’ve downloaded to put Adsense Ads in my blog’s sidebar. Being able to USE programs and NOT write them, I have a few remedial questions, please: What does “call the function” mean in kindergarten terms? Where do I put the google ad code, again, in kindergarten terms, please?
I’m sorry to be such a pain. Thanks in advance for your response!
.-= Cheryl´s last blog ..Multilevel Marketing is Here to Stay =-.
#22 by yudhi on February 20, 2010 - 1:50 pm
hii..thank you very,,very much, its useful for newbie like me
.-= yudhi´s last blog ..New Microsoft Windows Phone 7 Series =-.
#23 by Andrew Molobetsi on February 14, 2010 - 7:54 am
I also tried this plugin or something similar a few months back but got stuck before I could finish setting it up. Too technical, perhaps. Maybe if I give it another go it will work. Wish me luck!
.-= Andrew Molobetsi´s last blog ..Need Cheap, Reliable Web Hosting Fast? =-.
#24 by gozn on February 9, 2010 - 8:10 am
very think you !!!
#25 by ONLY IN THE PHILIPPINES on January 18, 2010 - 8:57 am
Great article. I will try to use this plugin in my blog. More power!
.-= ONLY IN THE PHILIPPINES´s last blog ..DECEMBER 2009 PROFESSIONAL ELECTRICAL ENGINEER EXAMINATION RESULTS =-.
#26 by afvia on January 8, 2010 - 2:47 pm
Good Plugins … , I New Blogger, and this tips, it’s important for me. Thank’s
.-= afvia´s last blog ..Windows Mobile 6.1 Custom ROM Samsung i900 Omnia =-.
#27 by admin on January 4, 2010 - 3:33 am
@Cyberquill, thanks for the correction… I have updated the plugin.
#28 by Cyberquill on January 2, 2010 - 10:17 pm
Ooops–I meant it said adsene three times.
.-= Cyberquill´s last blog ..The Ministry of Silly Counts =-.
#29 by Cyberquill on January 2, 2010 - 10:15 pm
Just downloaded the plugin. Haven’t tried it yet. I’m sure it’s great.
One typo: On the WP Settings page it says adsense three times:
Options
Adsense Ad Campaign 1 Code:
Copy and Paste the Google adsene code here. To show this add in your posts or pages use the token
(2 more times below that)
.-= Cyberquill´s last blog ..The Ministry of Silly Counts =-.
#30 by admin on December 28, 2009 - 8:05 pm
Looks like you did everything right… please note that there is a bit of delay before the ads start to appear for a newly created Adsense unit (I have seen upto 30 mins of delay sometimes)
#31 by Paul on December 28, 2009 - 1:37 pm
I am looking for plugin that I can insert the Google adsense on sidebar. I found your plugin and thought it would be the solution. However, after installation two plugin, “Simple Google Adsense” and “PHP code”, the ad did not show up on my sidebar. I wonder if what I did was wrong. I entered the Google adsense here, Adsense Ad Campaign 1 Code. Then I entered the code to call and execute the campaign 1 code in PHP widget under the widget template.
Am I missing some steps here? Please help.
Thanks
.-= Paul´s last blog ..Other PLUGINS You Need to Strenghten Your Blog =-.
#32 by Skye @ American Doll Clothes on December 17, 2009 - 9:38 pm
I copy and pasted the code into my website and tried to align left and it did not work. I believe that the code is broken.
.-= Skye @ American Doll Clothes´s last blog ..5 Must Know Tips For Making Doll Clothes =-.
#33 by Dave on December 5, 2009 - 1:18 am
Love the plugin…ran into a problem though. The adsense code works absolutely great for content insertion into my WP posts, but only the top 3. Anything after that is blank.
I used the same campaign for the posts inside the code. I havent had much of a chance to research it, but have you heard any issues with templates and the plugin?
I am going to look into google next to make sure it isnt flagging me for flooding as i insert one block on each blog post, but if there is an issue please let me know
Really great work on the plugin never had one bit of trouble getting it setup and implemented!
#34 by Yjc on November 27, 2009 - 10:39 pm
Awesome plugin! Super thanks!
.-= Yjc´s last blog ..Online with The Clockwork Orange! =-.
#35 by Lydia on November 15, 2009 - 9:02 am
This seems like the perfect plugin for me. Not got the sidebar working yet but having read the above I’m sure I will soon. Yes that is all I want – the possibility of 3 sets of ads.
Many thanks.
Lydia
.-= Lydia´s last blog ..Buy a JML Halogen Oven =-.
#36 by Bart Heemskerk on November 8, 2009 - 10:30 am
Thank you for making this great plugin!
#37 by ben gumbelt on November 3, 2009 - 4:20 pm
nice info, i like this plugin, very useful, thanks for your sharing
.-= ben gumbelt´s last blog ..The secrets of Internet Marketer Successfully =-.
#38 by admin on October 30, 2009 - 8:11 pm
@Charlie, edit your “single.php” file and call the function. This will put the ad code on every post.
#39 by Charlie on October 30, 2009 - 8:05 pm
Hi, I was wondering how can insert the code automatically into every post?
Which template file would I need to edit? Thanks