New Feature: Old Post Alerts

Note: This post is over a year and a half old. You may want to check later in this blog to see if there is new information.

Introducing a new feature on the Circle Six Blog: Old Post Alerts. I’ve modified Alex King’s plugin to include related posts that are newer than the current post. So if the post is over 1 month old, it tells you in general terms how old the post is, and then, if available, offers newer posts that may be related. Here’s the code…

Download this file: c6oldpostalerts.zip and unzip it. Note that this is not a plugin. You’ll need to add it to your single.php or header.php page by hand. You can place it at the top of either page, but I prefer to have it just on the single page if it’s available so that it only has to be read when appropriate. You could also use an include statement, or go ahead and make a plugin out of it. I chose not to because it requires that you’ve run the related posts plugin install script that will convert your database to handle a full text search. If you can handle the coding, and you’ve run the fulltext script, then this should work great for you.

Once you’ve got the code in place, you now have a function called “old_post_alert” that returns a paragraph with the general age of the post and an unordered list of related posts. As an aside, the posts are retrieved based on their matching score, and then the array is sorted by date in descending order. So all you have to do is include

<?php echo old_post_alert(); ?>

in your template where you want the paragraph and list to appear. Mine appear before the title of the post.

The paragraph has a CSS class of “special” and the unordered list has an ID of “newerposts” that can be used for styling. You can easily change these in the code.

» » » » »
  1. york times » New Feature: Old Post Alerts 04.01.07 / 8pm

    […] unknown wrote an interesting post today onHere’s a quick excerptIntroducing a new feature on the Circle Six Blog: Old Post Alerts. I’ve modified Alex King’s plugin to include related posts that are newer than the current post. So if the post is over 1 month old, it tells you in general terms how old … […]

  2. DamionKutaeff 03.23.08 / 10am

    Hello everybody, my name is Damion, and I’m glad to join your conmunity,
    and wish to assit as far as possible.

Have your say

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>




Safari hates me