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!













There Are 30 Responses So Far »
Pingback: Sxc.dk » Mere om WP
Pingback: WordPress ?? ??? ??? snippet
Pingback: How To: come inserire adsense dopo il primo articolo su Wordpress! - Geekissimo
Pingback: 100+ Killer Wordpress Resources | Steffan Antonas’ Blog
Pingback: Grumpy Git . org » Blog Archive » Links for 2009-05-03 [del.icio.us]
Pingback: 6 Tips to Take Your WordPress Theme from Good to Great - Fantastic Web Design
Pingback: Show | Display | Insert ad after first post in WordPress | Khapay
Pingback: Como mostrar Adsense después del primer post en el home Wordpress
Pingback: Show | Display | Insert ad after first post in WordPress