
A reader wrote:
Dane, how do you place advertisements (or other content) after the first (and subsequent) posts on your blog?
Something I’ve done with my blogs for a long time is to place a variety of different content after different posts on the front page. For instance, on all of the Business Opportunities Weblog blogs I’m showing a list of recent comments immediately after the first post on the home page. This is very easy to accomplish with only a simple change to your Wordpress templates.
In your index.php template, inside the loop, below your post tags and above the “endwhile” add this:
$adcounter = $adcounter+ 1;
if ($adcounter == 1) { }
if ($adcounter == 5) { }
To put something in the space immediately below the first post, where I put my recent comment list, put it in the brackets after $adcounter == 1. To put something after the fifth post, put it inside the brackets after $adcounter == 5.
Here’s my code:

With this technique, it is possible to put ads or other unique content after every single one of your blog posts.
Have fun.











Peter Morgan on July 24th, 2007 at 7:31 am
An excellent idea! Thanks for this. Never thought of spacing item like this. Very simple!
Lucky wordpress if flexible to enable this kind of tinkering.
Best regards
Peter
Peter