Regardless of your knowledge of PHP, one of the greatest thing about Wordpress is having the ability to insert a small snippet of code and have drastic changes to your blog. Anyhow, if you goto our blog’s homepage, you will see a small Google Adsense ad running underneath the latest post. This is a great way to increase CTR and ad exposure by effectively using the little space your users will most likely see.

Steps to Show Ads
Look for the following code in your Main Index Template (index.php):

<?php endwhile; ?>

Insert the following code right above it:

1
2
3
4
5
<?php $show_ads++; if($show_ads==1){ ?>
 
// YOUR AD CODE RIGHT HERE
 
<?php $show_ads=1;}?>

Explanation
This small piece of code simply says to add 1 to the $show_ads variable and if the variable equals 1, then post the ad code. Then it goes on to redefine the $show_ads variable again as 1 so it will always be 2 after the first time around. Be sure you style your ad code to match your theme!

Tips
In an article posted last month, I listed out the top 10 most useful plugins for Wordpress and one of them was an ad rotation plugin. I highly recommend you use Datafeedr Rotating Ads not only for this small hack, but other ad spots in your blog as well.

Learn how to separate trackbacks and comments in Wordpress to further enhance your blog.