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
- [wp_ad_camp_1]
- [wp_ad_camp_2]
- [wp_ad_camp_3]
- [wp_ad_camp_4]
- [wp_ad_camp_5]
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.
Plugin Download
Download the Google Adsense Plugin.
Compatibility
Works with the latest version of WordPress.
Requires
Requires WordPress 4.0 or higher.
Donation Option
Donation option can be found on our 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
- Version 1.5 – Added a 5th ad slot
- Version 1.6 – WordPress 3.8 compatibility update
- Version 1.7 – WP 4.2 compatibility
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 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.
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!
very think you !!!
Great article. I will try to use this plugin in my blog. More power!
Good Plugins … , I New Blogger, and this tips, it’s important for me. Thank’s
@Cyberquill, thanks for the correction… I have updated the plugin.
Ooops–I meant it said adsene three times.
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)
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)
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
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.
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!
Awesome plugin! Super thanks!
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
Thank you for making this great plugin!
nice info, i like this plugin, very useful, thanks for your sharing
@Charlie, edit your “single.php” file and call the function. This will put the ad code on every post.
Hi, I was wondering how can insert the code automatically into every post?
Which template file would I need to edit? Thanks
Really nice plugin for noobs ……….
Great plugin!
I usually try random php function to test more effective adsense and so more than 3 camps will be usefull.
Thank you
@Sidh, Google won’t serve you Adsense ads when your site is on your local computer
Hi, Thanks for the plug-in. I have one question regarding plugin. I did everthing as per the procedure given by you. But how will I see the Google ad practically ? I didn’t receive any error message. But I couldn’t see Google ad ! I am trying this with at my localhost. Is there any way I can see the Ad in the localhost ?
Hi
This is for blog, Is there any thing which does the same thing with ordinary pages created with frontpage?
Very good work, and thank you. Exactly what I need.
Hi Zoey,are you using the PHP code widget or the normal Text widget? Please note that the normal wordpress text widget doesn’t execute PHP code so you will have to use the PHP code widget.
I’m trying to use your plugin via the php widget method so it will show up in my sidebar. I am using WordPress 2.8.4 and theme is Arthemia. Don’t run into any problems when I’m setting it all up but it just appears as blank on the website.
Can you help??
OMG please just ignore me – just read further down the comments above and saw that someone had the same problem…followed their lead. It works fine now. Thanks!
xx
Hello
I am using your fabulous plugin – so far so good. Just trying to get my adverts to get the text wrapping code (as explained above) working, to no avail.
My HTML code within my blog looks like this :
…..best life of our dreams…the Ultimate Lifestyle.
As the ancient Chinese proverb states…..
but it is just not wrapping. Can you please help me??
thanks so much.
Newbie here. Will this plug in work for WP version 2.8.4?
FINALLY, a simple no nonsense adsense unit that actually works. Good job, thanks very much for this.
Hi there, Thank you for the response. My test site is
http://perfectlamp.net/wp-admin/index.php
Thanks again.
Rod
Hi Rod, I am not familiar with the FCKEditor so can’t really tell you what is going on. If you can give me access to your test site if you have any then I could have a look and see what is wrong.
Greetings,
I’m a newbie with a funny question. You mentioned that I need to insert a trigger on a page in html view. However I do not see the switch button on my WordPress control panel. BTW, I use a plugin called FCKEditor. I noticed that there’s a button that that menu called Source which toggles between regular text and seeing some kind of code with tags. I pasted the trigger to the end of the code but still no luck. Can you help me please? Thank you.
Rod
Hi Frank, The settings menu for this plugin is located under “Settings->Simple Adsense Insertion” on the left hand sidebar in the admin menu.
Hi, I installed and activated ‘Simple AdSense Insert’ on my WP website (ver 2.8.1) with the theme ‘iNove 1.4.5 by mg12’. According to step 3 in your installation guide, I should be able to config 3 adsense codes, but I just don’t see this option in ‘Settings’. Any suggestion? Thanks.
hi, i like using this thing, it’s so simple and easy to use.
Could i make a suggestion of having to put a drop down button in the WP edit post page to select which of the three ads you want to put (with a title or desc). beats referring to the plugin page for copy-pasting.
@NoirMom, Please download the latest version 1.1 from this page.
I am having the same exact problem as Capt. Ed & Donna the code is not saving when I hit the update button.
After I hit update and then move to my post to insert the trigger word the google ad code is not saved.
Please help
Hi,
That was exactly it! It was cutting/pasting the quotes from your post and onto the editor. Funny how something so silly could be the cause of the problem. Many thanks for catching that! It works like a charm now.
Hi S, I just tested it in WP 2.8 and it works fine. I have a feeling you are directly copying and pasting the example code. Please note that when I publish the post, wordpress changes the double quotes (“) character to a slightly different type of double quotes. To get around it, please delete the double quote from the code after you paste it and reapply it manually using your keyboard and don’t forget to paste the code in the HTML view of the post.
just to clarify “div” tags. I put the actual tag in the above post and I guess it was read as HTML.
It still doesn’t show in the preview. For your reference, I’m using the latest WP build.
I believe I read somewhere that WP’s HTML editor didn’t like tags.
Can you please check the post preview After you add the style info in the HTML view of the post and before you save the post and let me know if you see the ad unit text wrapped in the preview?
Hi there I like your post
Hi,
First of all, many thanks for this plugin! It’s an awesome tool! I tried to wraparound text just as you explained, but everytime I save the page, it wipes out the style parameters I set for the tag. Am I missing something?
You post is very helpful to me and I
I had another plug in that was interfering plus, with AdSense you’re only allowed 3 ad blocks per page which I forgot about. Sorry about that…
I only see one ad on your blog posts.. are you placing more than 4 ad blocks?
Hey there,
I’ve upgraded to 1.1 and made sure all of my ads were placed with the correct tags, but I only get about 4 ads on my blog under each entry and the rest don’t show up. Any ideas?
@Valerie, I have added a section “How to Add Google Adsense to the Sidebar” under the “Additional Documentation” in this post which should help you insert Adsense to your theme’s sidebar.
Hi,
I’d like to know how to get the Adsense Ads on my sidebars only. I don’t want them in my posts, but would like to see them on the sidebars of my posts (and home page).
Sorry, very new to all of this!