How To Display an Advert After Your First Post in WordPress

Adding ads into your WordPress blog is a great way to make money. This tutorial will show you how to add a Google Ad (or other) after your first post on your blog

Adding Code

  • Navigate to your WordPress theme folder. Open index.php
  • Search for the following code
<?php while (have_posts()) : the_post(); ?>
  • Replace with
<?php while (have_posts()) : the_post(); $loopcounter++; ?>
  • Search for
<?php endwhile; ?>
  • Just before this put

<?php if ($loopcounter <= 1) { include (TEMPLATEPATH . '/ad.php'); } ?>
  • Change /ad.php to the file that contains your advert code

Leave a Reply