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.
Google’s Adscense policy.
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. So I wrote my own Simple Adsense Insertion Plugin for WordPress, to focus on having 1-5 Google Adsense codes saved and use them where ever I want on my site by inserting a simple shortcode to my posts, pages and sidebar.
Simple Google Adsense Plugin Installation
- Unzip and Upload the folder ‘WP-Simple-Adsense-Insertion’ to the ‘/wp-content/plugins/’ directory.
- Activate the plugin through the ‘Plugins’ menu in WordPress.
- Go to Settings and configure the options eg. Copy and paste the Google Adsense code that you want to use.
- Add the trigger text [wp_ad_camp_1] to a post or page where u want it to appear.
Simple Google Adsense Plugin Usage
There are two ways you can use this plugin:
1. Add one of the following shortcodes (trigger text) on a post or page
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(); ?>
- <?php echo show_ad_camp_4(); ?>
Using In-Article Ads
This plugin allows you to automatically insert adsense ad code after the 2nd paragraph of every posts. If you want to use this feature then copy and paste the ad code in the In-article Ad Code field of the settings menu of this plugin.
Adding Adsense At the End of Every Article
This plugin allows you to automatically insert ad code at the end of every article. Go to the settings menu of this plugin then enter your ad code in the Post-article Ad Code field to activate this feature.
Download the Google Adsense Plugin.
Works with the latest version of WordPress.
Requires WordPress 4.0 or higher.
Donation option can be found on our projects page.
- 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
- Version 1.5 – Added a 5th ad slot
- Version 1.6 – WordPress 3.8 compatibility update
- Version 1.7 – WP 4.2 compatibility
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 a PHP code executable plugin if you don’t have it already. This type of plugins allow you to call PHP functions from the widgets (it is 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, check out our list of best WordPress plugins to find out what other plugins you should be using.
Comments (195 responses)
@Darren, Yes. You will need to modify your theme’s template file to that though.
Can we add AdSense ads in a category loop page or a search result page, and specify specific spots, say for example, after or before the 1st and 3rd post on the list, something like that? Thank you. By the way, is it allowed by Google to place ads on those pages?
@Emily, You just have to use the shortcode in a post (the function call is if you wanted to use it in your theme’s template file).
Do I just have to put the short code into the post? Or do I have to do this too: ” Call one of the functions from your theme’s template file:” If both, how do I do the 2nd?
@Chris, This plugin works with any theme (so the theme shouldn’t be any issue). If you have added the adsense code using this plugin then you don’t have to worry about anything else. Just give it some time so the ads can show up. It does take a bit of time for a newly created adsense add to start serving. So check it tomorrow to see how your ad looks on the site.
I passed the initial adsense stage and now they have asked me to put the code on my website.
I used your plugin to do that but my account is still asking me to place the code somewhere. I’m using Divi theme, if that makes a difference?
Is this a common plugin / theme problem or is Google just taking their time to crawl the test ads?
Thank you very much for any reply 🙂
Is your theme showing only excerpt for the category archive pages? I don’t think the shortcode is being rendered on that excerpt.
Thanks for awesome plugin.
This plugin does not working on category archive pages. Its showing only shorcodes.
@Elton, Yeah you can use those shortcodes one after another.
Congrats for the plugin! It’s really easy to introduce the ads on pages.
One question, in case I want to place two ads side by side in the midle of a post or page, if I introduce the codes [wp_ad_camp_1] and [wp_ad_camp_2] one after the other I reach this feature?
I would like to see the option to add more sections as needed. Maybe a name function out to the side of each one so we can label them within the settings page. I think more slots for ads would be great because adsense lets you create a large variety of ads and gives you many different options for various pages/posting styles. Giving the user options like this would be great!
I use this plugin on one of my two sites, it really works great and I REALLY wish I had used it on the other as I’m now faced with changing a bunch of pages…
I’ll add my vote for having additional ad slots for a couple of reasons: Users might use different size and or colors of ads on pages than they do on posts. Having a variety of options is always good. Rather than using the additional slots to make a spamy page sometimes a different size ad will just fit better.
And I “assume” this plugin could really be used as an insert anything tool (haven’t tired it as I don’t have enough slots~~), which would really be handy for use with stuff you want to change site wide periodically…
Just my 2¢
Hi there Bro, I tried this today and it works perfectly. Unlike other plugins out there that try to embed “sneakingly” authors adsense code for revenue share, this plugin has no sneaky tricks. I just LOVE the simplicity and honesty of the Author of this plugins. I would happily pay something for this plugin. Thank you very much.
Great plugin. Love the simplicity. It’s also the only one that I could get to work on our theme (well I stopped looking after I found yurs) :).
Does it only do adsense or could I create an affiliate ad that I could then add to certain posts using the shortcode? I guess I could test it to find out, but even if it did work I just want to make sure there’s nothing on the backend that might be causing some unseen issue.
Also, I copied the instruction for “how-to wrap” directly from your post. I couldn’t get it to work at first until I noticed/switched the smart quotes to the inch mark. Thought I would mention it in case anyone else has had the same issue.
@Albert, At the moment there is a limit of 4 adsense ad. When I first created this plugin I didn’t think you would need more than that many ads (because if you use too many ads it starts to get spammy). I find that 2 or 3 nicely positioned ad can do really good (rather than slapping too many). If a few users want more than 4 ads, I will add the option for that.
It works fine for me. But is it possible to place more than 4 adds (different codes) on a page. Now i see [wp_ad_camp_1-4]. Is that the limit?
Thanks in advance
@Catherine, You don’t have to add anything in the stylesheet. You can open your theme’s “single.php” template file. Then use the code just below the title and that will show the adsense ad below the post title. Or you can use the shortcode inside your post (when you are editing a post you can insert the adsense shortcode).
Hi there. We would like to have a leaderboard Adsense banner across the top of our landing page (under the header).
Our website developer charges us huge fees to keep going back to have them ad things, tweak things, etc. We are trying to do this ourselves to avoid them but we are scared we’ll mess something up.
Would I insert this plugin in the stylesheet? We know how to insert things in the sidebar but don’t want another ad there. Our issue is inserting things in the upper part of the page. Can you advise?
Love this plug in for google adsense. So easy to use.
The simplicity and straight action of this adsense plugins cannot be over-emphasize. This is really great . Thank You.
@Jo, at the moment we have set a limit of 4 ads because we find that using more than 3 to 4 ads on a page makes it look very spammy. However, we have received a few requests to increase the number of Adsense ads you can have with this plugin. We intend to add a few more slots in a future version.
Hi 🙂 Your plugin has made life incredibly easy for me 🙂 I just wondered, is it possible to use more than four ads or is that the maximum? Thanks x
@Sabrina, Yes this should work with 3.5.1.
will it work with 3.5.1 wp ? any body?
Its one of the most useful WordPress Plugins for Adsense Ads management. I have no knowledge of PHP coding but still this plugin helps with the insertion of ads easily. Thanks for creating this useful plugin and offering it free of cost
Thanks for sharing the plugin. will try it in my blog.
Cool. I didn’t know I can actually do that one to make things simpler. I will try to insert Google adsense your way to my wordpress blog.
This plugin is very useful… I tried 3-4 adsense plugins, but this one works great…
I’ve been looking for the perfect Adsense Plugin for my new website and I found the answer in this Plugin. I will surely recommend this to others. The best and simplest one by far, a Million Thanks, really.
This plug-in is really useful!
easy to use it. thanks
Awesome plugin… About the only decent one that allows you to insert Adsense into PAGES and not only posts. Worth donating to this one!
Excellent plugin.Thanks for sharing.
This plugin is very easy for beginners and works great. One of the most user friendly WordPress plugins available in the market thanks for sharing
This plugin works great to deliver content in ways that seem complicit with adsense’s TOS. My biggest goal is to deliver ads in a way that won’t hurt user satisfaction with my site, so thanks! I’m giving it a whirl. fingers crossed. 😀
You fixed my broken ads problem with this plugin. thank you!!!
thanks for such a wonderful tips and support and i like your website so much
I just setup the plugin on one of my sites and it was very easy and works great. So far I have been adding AdSense code manually, but this is so much easier! Thanks for the great work!
Just started using this plugin on my own wordpress blog, you can have a max of 3 ads per page, and its boosted my adsense clicks.
Brilliant plugin .. I have never seen an adsense plugin which is SOOOO easy to use ! Well done … very well done
I spent all day working on Adsense ads, channels and putting ads on my posts. And
I just uploaded the Simple Adsense plug-in. It looks nice and easy to use.
This adsense plugin is something I will be using in the future. 😀 This will really help me allot. 🙂
Excellent plugin. Sure made my life a lot easier.
like simple and easy,I will try this plugin, thanks for sharing this great information.
I,m new to Google adsense. But this is simple and great. Thank you