After writing a comment on http://www.problogger.net, I was “due” to post it here.
I managed doing the same though using a different method. Yes, it’s possible to do something similar using other way. But mine is, I would say, easier to manage. I got the wonderful Acme tech Adsense Deluxe plugin which allows me to plug the ad into the script easily.
My code is only added at 3 different places in the templates files:
1. In the theloop.php, find
<!--
< ?php trackback_rdf(); ?>
-->
then add this code just before
< ?php
if ($adsensevar == 2){
adsense_deluxe_ads('Midpage');
$adsensevar = 0;
}else{
$adsensevar++;
}
?>
This code will output a ad every 3 posts (but beware, google TOS says no more than 3 ads per page, so I’ve warned you).
2. In the sidebar.php
just before the div class clear, add
< ?php adsense_deluxe_ads('Sidebar'); ?>
This code output the ad in the sidebar
3. In single post
add
< ?php adsense_deluxe_ads('Midpage'); ?>
after the
< ?php include (TEMPLATEPATH . '/theloop.php'); ?>
call.
This will output the ad just before the comments and the comment box.
Using ad sense deluxe (which you should have actived), create a block called MidPage (which would generally contain the code for a 468×60 banner) and a Sidebar (which contains any scrapper kind) and you’re done. Might be a bit long, but it’s easier to manage after.
Ask any question if there’s a problem.

6 Responses to “Add adsense in your Wordpress blog”
plz tell me how to use adsense deluxe in any theme other than k2?
I have ten posts on every page now i want that adsense deluxe automatically show first ad after first post then show second ad after fourth post and at last third ad after ninth post.
Every time when i ad new post the ads should be automaticallly shown in that order.
First, you should know that google as a restriction about how many ads are shown per pages. Secondly, using adsense deluxe can be use in any other theme than k2, you simply have to adapt the places where you put it.
Note that you only need to put < ?php adsense_deluxe_ads('barname'); ?> in order for a banner called barname in adsense deluxe to show up.
Hello,
If you don’t want to play with Wordpress plugins and want an Adsense Wordpress theme, have a look at.
Ad Flex:
http://www.vklabs.com/wordpress-themes/wordpress-theme-ad-flex.php
Blog Flex:
http://www.vklabs.com/wordpress-themes/wordpress-theme-blog-flex.php
Hope it helps
VK
hi nice site.
Thank You
Thanks, I was having soooo much trouble getting adsense to work on my website but with a plugin I finally got it to work. Thanks for the tip.