Wordpress Hack: Banner After First Post
Please subscribe to ProTycoon.com via the RSS Feed or Via Email.
I have had many people ask me how I manage to add an Adsense banner unit after the first and before the second post on my homepage, which is something that I do on some of my other blogs. I can now reveal to you how it is done, and how you can implement it into your wordpress blog.
First you will need to locate the index.php file for the theme that your blog is currently using.
Depending on whether you show full articles or excerpts on your homepage you will be looking for something slightly different.
If you show excerpts on your homepage you need to look for the following (or Similar):
<?php the_excerpt('Read More »'); ?>
If you show full articles on your homepage you need to look for the following (or Similar):
<?php the_content('Read More »'); ?>
This is the code that displays you posts on the homepage, with a read more link in most cases.
Now you have found this piece of code, you need to add the following code below it:
<?php if ($count == 0) : ?> !!YOUR AD CODE GOES HERE!! <?php endif; $count++; ?>
You need to add your Adsense code to the above code, then save the changes. You are done, this small piece of code will show your ads after the first post on your blogs homepage.













POYTSPOT | March 14th, 2008 at 11:32 pm #
hey thank you for this, i’ve been looking this technique since I started blogging… thanks…
David Shaw | March 16th, 2008 at 10:48 am #
Thats ok.
I was looking for it as well, then I just decided to do it myself!