Insert Ads In Between Blog Posts On Your Main Page

by

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.

If you liked this article, you may also like:

Time to Stop Reading and Start Blogging

Start blogging with WordPress

I have experienced many wonderful benefits achieved by having a blog. It has made an amazing difference for me in my life and career.

You can do it too. It literally takes 5 minutes to have your blog up and running. Follow my step-by-step guide on how to install WordPress and start blogging today.

November 11, 2008

Previous post:

Next post: