Stay up to date with our newest WordPress themes, WordPress plugins, WordPress tutorials, and other announcements.
I’m sure while browsing for WordPress themes, you’ve come across some that are advertised as being Adsense ready. What does this mean exactly? Basically this means the WordPress theme has been designed to have space for Adsense ads in the available dimensions. In reality, nearly every WordPress theme is potentially “Adsense ready” as any theme can have ads placed, wherever you want. In this tutorial, we’ll go over several ways on how to insert ads into your WordPress themes. You can do this through:
- A variety of WordPress plugins
- Inserting raw ad code directly into the post
- Inserting ad code directly into your template files
If you want valuable tips in inserting ads into your WordPress themes, read on.
There are many popular ad sizes on the internet today. Some from Adsense include:
- Leaderboard (728×90)
- Banner (468×60)
- Skyscraper (120×600)
- Square (250×250)
- Medium Rectangle (300×250)
- Large rectangle (336×280)
- Wide Skyscraper (160×600)
Some are tall, some are wide, some are square. Depending on the structure of your theme, you’ll likely have many ideal areas for different sized ads.
Using WordPress Plugins
Probably the easiest way to start serving up ads on all of your posts and pages automatically is using a WordPress plugin. I’ve found a few good ones worth checking out.
- Adsense Manager – This is definitely one of the most popular plugins out there for managing advertisements with over 50,000 downloads. Despite the name, not only does it support Adsense, but a number of other ad publishing services as well. Among these include Adbrite, AdGridWork, AdOpinion, AdRoll, Commission Junction, CrispAds, ShoppingAds, YPN, and WidgetBucks.
- All in One Adsense and YPN – This plugin is very easy to use. All you need to do is insert your Adsense or YPN publisher ID, and it will automatically insert your ads in all of your posts, on the fly. It allows you to choose the size and colors as well.
Those two plugins should be more than enough for now, however there are many other Adsense plugins available here.
Inserting Code Manually
Another way to insert ads into posts or pages is to simply paste the code into your post editor. Make sure you choose the Code editor, as pasting in the Visual editor will simply format the code into text, like this:
In the code editor, your Adsense (or any other ad) will be displayed properly on your page. While inserting your code into a post or page, it should look something like this:
The live blog post will look like this after successfully inserting a 468×60 Google ad.
I honestly wouldn’t recommend this method just because there are more efficient methods availalble. Even if you want to selectively insert ads in specific posts, the plugins above could do that as well by providing a simple tag to insert in your posts instead.
Inserting code directly in your template
If you’re comfortable editing template files, this will probably be the best way to effectively insert sitewide advertisements on your WordPress blog. Most WordPress themes are broken up into several parts:
- Header – The top of the theme.
- Sidebar – Take a wild guess.
- Main Index – The homepage listing of posts. Could apply to pages and single posts if not defined in other files.
- Single Post – Individual blog posts.
- Page Template – Static pages
For now I’m not going to get into conditional tags for even greater control, and will save that for a future tutorial. For our example, we’re going to insert a 468×60 ad directly below the content on the static pages. This will affect all static pages on the site, such as About. Simply insert your Adsense code like so:
Your static pages will all have Adsense ads displayed like this:
That’s all. If you liked the tutorial feel free to comment, share, subscribe to the feed. Enjoy!
About Leland Fiegel
Leland Fiegel was the original founder of ThemeLab. He is a web developer who loves WordPress and blogging.