Building Your Website, Step-By-Step

RYO ‘Oldest to Newest’ WordPress Plugin

A WordPress webmaster wanted a routine that would periodically take the oldest post and make it the newest post, showing up at the top of the home page. This would rotate articles through the system, recycling old material.

This was similar to something I was thinking of doing, so I did this one along the way.

See all of our WordPress Plugins

This routine checks to see if an article has been posted in the last n number of days, and if not, it locates the oldest post and changes the timestamp to the current day and time.

The interval is initially set at 7 days (one week); this means that every week if a new post has not been made in the last 7 days, an old post will be rotated to the top of the list and stamped with the current time and day. The plugin will also ping your standard ping list.

The interval may be changed to any number of days that you prefer by editing the days variable in the admin panel. By setting this large enough, it could be a day, a number of days, or weeks, even a month. (A week would be 7 days, a couple of weeks, 14 days, etc.) Or it could be as short as one day. It's up to you.

A rotation will not occur unless a page is loaded from your WordPress blog. So if you're extremely low on traffic, the rotation will be delayed until you have a visitor.

You might not want to use this if the timestamp is a critical component of your website, as the routine will change the timestamp with each move.

And if any of your posts are time sensitive, that is, if they mention news events, sporting events, etc., it would be a bad idea to use this.

Features

  • Checks to see if an article has been posted in the prior period; if not, the oldest post is made fresh with a new timestamp.

  • The method allows you to post new articles and they maintain new status. Old posts are made new only if there's nothing new already.

  • The default period is 7 days, one week. This may be adjusted depending on your requirements.

  • If the old post is over six months old, the pinging mechanism will be engaged, just as if you'd manually changed the timestamp and republished the post.

Instructions

  1. Add the plugin as you normally would with the WordPress plugin uploader, and activate it.
  2. Change the number of days in the admin panel, if you want something other than 7.

Download

Version 2.0.0: Download

Change Log

Version 1.0: Initial release for WP 2.0.5.

Version 1.1: Changed to rotate an old post only if nothing new has been posted. Added ping routine for old posts older than six months. Changed default period to 7 days.

Version 1.2: Changed to update post modified date to match post date, query posts only, clear WP cache, reduce database queries.

Version 1.2.1: Added automatic update capability.

Version 2.0: Added admin panel to make it easy to change the number of days between processing. Changed the system to use the WordPress scheduler.

17 Responses to RYO ‘Oldest to Newest’ WordPress Plugin

  • Thank you thank you thank you! I’ve been looking for something like this for a year now.

  • Will this work with the latest wordpress version?

  • Thank you!!! I have been searching for a plugin like this for 2 hours!

    The last sentence in your post is a bit sad.. “If this plugin is helpful, use it. If not, ignore it; I probably won’t be interested in upgrading it.”. :/

    Anyway, thank you!

  • Thanks for a great plugin.

    I was wondering if there was a way to use this plugin on a specific category. I’ve tried to use cat_ID in the getvar but I failed miserably :)

  • Hey Rich, I was having trouble getting oldest2newest working on my WordPress installation, version 2.5. I took a little time and fixed the problem. I guess you have to include the wp-config.php file in the plugin now.

    Here is a link to the file on my website…
    http://www.ryanyockey.com/oldest2newest.zip

    Thanks for such a helpful plugin. I’ve been using it for the last year or so.
    -Ryan

  • This is a great little plugin! Very helpful indeed! Would be really cool if you could set it up to ping weekly with the rotation/updating…
    Anyway, THANKS!

  • It DOES ping weekly, as long as the old post made new is at least 6 months old. This is to avoid a small website with only a few posts re-pinging again and again.

    Another user released the exact code, calling it “Oldest To Newest Redux,” and the only difference is leaving out the six-month check and changing the repost to 24 hours. He seems to think this has something to do with WP 2.7, but it does not.

    And while I haven’t been updating it, and don’t really plan to, it hasn’t needed it. I used it on WP 2.0 and I’m still using it on WP 2.8. That said, since my attention was directed back here recently I have made some efficiency updates and uploaded version 1.2 today.

  • Is there a way to exclude certain posts by using the ID or slug?

  • Hey Rich, is it possible to rotate posts from just the last month and not the oldest? Thanks!

  • Trini, sorry, no.

  • Hey, does this thing still work? It’s just what I’m looking for, but we’re at wp 3.1~!

  • I just updated this to version 2.0 and made it possible to reset the days cycle in an admin panel, so no more editing code!

    I also changed it to use built in WordPress scheduling.

    And, yes, it still works; as I write this WordPress is at version 3.5.1.

  • Great!

    I need to rotate post for hours. 1 hour, or 2 hours, etc … But it is possible with this plugin. You can help me with this?

    Thank you!

  • Does this also work for the static pages as well?

  • This is only for posts, not pages. Pages are not date based.

  • Rich,

    Is there anyway you could modify this plugin to also work for custom post types (taxonomy).

    I have used the plugin on several sites and it works great for normal wordpress posts, but it does not work for my custom posts.

    Any Help would be appreciated.

    Thanks

  • there seems to be a problem with the latest update:

    Fatal error: Call to undefined method stdClass::toWpFormat() in /home/content/p3pnexwpnas07_data01/89/2679089/html/wp-content/plugins/ryo_oldest2newest/plugin-updates/plugin-update-checker.php on line 270

Leave a Reply

Your email address will not be published. Required fields are marked *

Member Center
UserID:

Password:


Ads

Your Own Dot-Com Domain
cinderelladomains.com
Our Recommended Source for Securing Your Domains. Fast Registration, Direct Support Phone

Reliable Website Hosting
siteground.com
Small businesses often use Shared Hosting and the "GrowBig" plan. Free LetsEncrypt SSL included.

Create Your Own Graphics
razataz.com/graphicshb
Website headers and banners are easy to do yourself when you have this inexpensive tool!

Do Your Own Webinars
webinarjeo.com
Unlimited Webinars. Unlimited Attendees. Unlimited Scalability. True Live-Streaming Performance