Have you ever tried to insert advertisements (or any bit of code really) into the WordPress post loop, then found that it will insert the banner after each post? It really depends on what you are going for, but this usually will not be an ideal solution to placing advertisements between posts on your homepage. If you’d like to place something only after the first post in the WordPress post loop, here is a quick hack you can do to tell WordPress to only display it after the first post.

Simply go to your themes homepage and look for the following code:

<?php endwhile; ?>

Immediately before this code, place the following code:

<?php if(!$show_ads){ ?>
Insert Code Here
<?php $show_ads = 1; } ?>

Obviously you’ll want to replace Insert Code Here with your code. Told you it was easy!

Republished by Blog Post Promoter

Tags:

Related posts