We had a look at how you can automatically insert the ads in between your blog title and the blog content, now we will take a look at how you can insert the ads in between the blog posts on your blog front page.
Again you would have to do a simple change in your WordPress admin control panel by going into Design menu and choosing the Theme Editor. This time we will take a look at the Main Index Template, the index.php. Find the following line:
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
You need to insert the following line above it:
<?php $count = 1; ?>
Now find the line that starts with following:
<?php the_content
After the closing tag of that section (?>) insert the following code:
<?php if ($count == 1) : ?>
YOUR GOOGLE ADSENSE CODE HERE
<?php endif; $count++; ?>
Now your blog ad will show in between the first and second blog posts on your blog front page. You can see this in action at HowtoMakeMyBlog.com.
Join thousands of bloggers and get all my blogging tips for FREE! Subscribe to HowToMakeMyBlog via RSS or via e-mail.



{ 7 comments… read them below or add one }
Brilliant!
I’ve been looking for this for a while. Thanks so much.
@Rahul, thanks a lot for your comment! I am glad that I could help!
thanks for the help, very useful info!
I cannot find the line which you provided in index.php
@Mohammed – It can be different from theme to theme so please check with your theme designer and the help files he has.
that line can be found in theloop.php
@M, thanks for the comment! looks interesting, I will take a look at it.