Lost in a list. Eye catchers.
Every blog has a list of some sort, whether it be a list of posts, search results or a list of archives. Often times these lists get rather lengthy and some times it would be nice to be able to put a promotional item into that list, or if we are speaking search results page, something of this nature. “Can’t find what you are looking for, click here” See image below.
Notice the Yellow area above, this is a great example of an inhouse promotional item, in this particular example we are trying to encourage users to subscribe to our RSS feed.
How its done. First go ahead and create a new page, we called our subscribe.php in this page we added some text and some styling <div class="promo">
<p>Don't forget to subscribe to our RSS Feed Click here to subscribe
</p>
</div>
Second, go to your list page, for our case its our search.php page, and locate your endwhile statement. <?php endwhile; ?> and insert the following <?php if ($loopcounter == 3) { include (TEMPLATEPATH . '/subscribe.php'); } ?> In English, you just said, after the first 3 posts display the page subscribe.php.
We use the subscribe.php page instead of just hard coding html into the main template file, so that at any given point we can just go to our subscribe.php and change it to anything we want without having to go into the main template file. A good reason doing this would be if you were calling subscribe.php from a few places, than you would only change subscribe.php instead of going into each page and swapping out code.
