Welcome to Dagon Design. In addition to free scripts, WordPress plugins, and articles, we offer a variety of services including custom theme design, plugin creation, and PHP scripting. Contact me for more information.

Version 1.31   Updated Tuesday, July 7th, 2009 at 6:18pm

Scheduled Post Shift Plugin for WordPress

This plugin automatically takes your oldest post, and updates its timestamp so that it appears as the latest post on your WordPress site. It does this by utilizing the cron feature built into WordPress 2.1 (and newer). It can rotate all the posts on your site, or just ones in specific categories. You can currently schedule it by setting the number of hours between shifts. For example, set it to 24 hours and it will shift the oldest post every day, at the time that you enabled it. You can also choose to only shift a post if it has been more than a set number of hours since the last post.

Download

  If you have found this page useful, please consider donating. Thanks!

Instructions

  • Download the above file, rename it from .txt to .php, and upload it to your plugins directory
  • Enable the plugin
  • Configure the plugin options (under DDPostShift)
  • Click the ‘Enable Post Shift’ button to start

Disabling the Schedule

To stop the schedule, simply click the ‘Disable Post Shift’ button on the options page.

Change Log

  • 07-07-09 Version 1.31 – Added option to only shift a post if it has been a set number of hours since the last post was added.
  • 02-22-09 Version 1.3 – Updated to work better in recent WordPress versions. Log file support added, and several other updates. Can also shift posts when no drafts are available.
  • 08-28-08 Version 1.22 – A few bugs fixed. Now supports multiple category rotation.
  • 04-27-08 Version 1.21 – Updated for WordPress 2.5 and to be compatible with WP Security Scan plugin
  • 09-29-07 Version 1.2 – Updated for WordPress 2.3
  • 05-16-07 Version 1.1 – Updated for WordPress 2.2
  • 04-09-07 Version 1.0 – First release

Options

Here are the options available in this plugin’s options page in the WordPress admin panel.

Shift Delay

This is the number of hours between post shifts. The schedule will start as soon as you click the ‘Enable Post Shift’ button.

Only Shift after X Hours

If used, a post will only be shifted automatically if it has been more than this many hours since the last post was added.

Category IDs

If left blank, the plugin will operate on all of your posts. If you enter a comma-separated list of category ID’s, it will only update posts in those categories.

Log File

Full path on your server where you would like the log saved. You can leave this specific to this blog, or set up a global log for multiple blogs. Leave blank to disable this feature. Be sure to give this file write-access

  1. When you get the version compatible with WordPress 2.9.2?

  2. a post will only be shifted automatically if it has been more than this many hours since the last post was added.

  3. Hi Admin!
    I love the plugin and have been using it for a while. It works great. I just have a quick question. Is it possible to have it only rotate posts that are a specific age, and not just the oldest? Say 1 month ago? I wouldn’t mind giving the code a GO if you can point me in the right direction :D Thanks again!

  4. Hi! Thanks again for this great plugin. I just have a simple question. If you select the categories to shift, does it also include the child categories?

  5. Thanks!! Started using it, seems to help me to rotate posts as I wanted to!!
    Thanks again!

  6. Great Plugin. Great contribution to WP community. You have money. Paypal sent.

  7. Bài vi?t r?t h?u ích. C?m ?n b?n.

  8. Bài vi?t r?t h?u ích. C?m ?n b?n.

  9. i tried add your plugin, its works ok ,, but post can be renew only once.. What should i do, to make automatic renew for all posts?

  10. Thanks for the great plugin.

    I am getting this in my error logs every time the plugin updates:

    PHP Fatal error: Call to undefined function sdp_log() in /home/mysite/public_html/wp-content/plugins/dd-scheduled-post-shift.php on line 277

    Write access does not help and if I leave the Log File option blank to disable the log feature I get this on the bottom of the page:

    Error reading log file (). Most likely you have manually removed the log file, or alternatively this could mean that the logfile is read-protected (change the rights of this file to 777)’)

    I do not need a log. Can I delete the lines of code that attempt to write to the log and what lines do I delete?

    If I knew more PHP I could figure this out myself, sorry. Everything else works great – I love this plugin!

    P.S. – Come buy a guitar from my website.

  11. Hi, the pluging thinks it is working, but I am not seeing any changes on the blog, nor id the app changing the log file – all have write ability? are you aware of any clashes with any other plugins?

  12. thank you very much for the post! just subscribed to your rss! ;)

  13. 74
    Ajay

    I was wondering that in addition to the changing the postdate / time stamp function whether it will also ping also.

    Thanks & Regards,
    Ajay

  14. Trinifieds: Sure, currently, the setting is in hours. So find this line in the script:

    wp_schedule_event(((int)get_option('ddps_delay') * 3600), 'ddps_schedule', 'ddps_postshift' );

    3600 is the number of seconds in an hour. So if you change that to 1800 for example, then a setting of 1 would mean 30 minutes. Just divide it however you like.

    If you wanted to, you could even remove the multiplication, and then the value you enter is the number of seconds until the script runs.

  15. Hi, is there a way to set the rotation to less than an hour?

  16. Version 1.31 Released

    This update adds an option to only shift a post if it is been a set number of hours since the last post was added (set to 0 to disable this feature).

    This plugin has been tested, and works, in the latest release of WordPress – 2.8

  17. 70
    Barry

    My plugin is working fine now. I just needed to imput the category I’d number instead of the category name.

    Thank you. Barry

  18. 69
    Barry

    My selected post are not rotating.
    I created a new category for the post I wish to rotate. I called it ‘Top Post’. That is what I typed in for my Category ID(s)field in the plugin set up. Everything seems like it should be working. Did I miss something?

    I get this response in my Scheduled Draft Publish log:

    06/14/09 08:37:24 wp_ Unable to find a post to shift.
    06/14/09 17:05:25 wp_ Unable to find a post to shift.
    06/15/09 17:12:17 wp_ Unable to find a post to shift.
    06/15/09 19:03:25 wp_ Unable to find a post to shift.
    06/15/09 19:06:12 wp_ Unable to find a post to shift.
    06/15/09 20:00:20 wp_ Unable to find a post to shift.

    Please help, and thank you very much. I think the plugin will be awesome when I get it running.

    Barry

  19. 68
    Lee Boswell

    i am trying to use the plug-in on a WordPress MU site but the script gives me the following error..Any ideas?

    Fatal error: Cannot redeclare ddps_add_option_pages() (previously declared in /home/ttpstude/public_html/blogs/wp-content/mu-plugins/dd-scheduled-post-shift.php:26) in /home/ttpstude/public_html/blogs/wp-content/plugins/dd-scheduled-post-shift.php on line 29

  20. 67
    Brian

    Maybe I’m doing something wrong, but the posts seem to shift for a day, and then revert back to the normal posts the day after. I’m running WP 2.7.1

  21. This is a great way to save time everyday. I’m glad I found it!

  22. What a great little plugin. Thanks mate. It gives my home page a renewed look everyday :)

  23. nice thanks man….

  24. 63
    Richard

    Thanks for the update. I can confirm this is now working correctly on wp2.7 Many thanks!

  25. Richard: The wrong copy was uploaded – This has been fixed. The category selection should be working now, and the shift should start 1 specified interval after the time you enable it.

    As for the file being created automatically – that is by design. Otherwise you would have to have a pre-created folder with write permissions for it to create the file in. It is no less work to just create the file manually if you choose to.

    Please re-download and give it a shot :)

  26. 61
    Richard

    One further point; Your directions state “The schedule will start as soon as you click the ‘Enable Post Shift’ button.” On this version clicking the enable button appears to create an immeadiate shift, as well as starting the time delay.

  27. 60
    Richard

    Some feedback on v. 1.3 and wp-2.7 Plugin installs correctly and now holds the enabled status. There are some problems however.
    1- Log file needs to be created manually (not really an issue)
    2- Despite inputting one cat id (146) it advances category ID=1 (uncategorized)ONLY.

    Any help appreciated. Thanks.

  28. 59
    Richard

    Thanks so much for maintaining this plugin with an update for 2.7.

  29. Version 1.3 Released

    This update fixes many issues for users of recent WordPress versions. It has been tested in the latest release of WordPress (2.7.1)

    Log file support has also been added, to see exactly what the plugin is doing.

  30. 57
    Richard

    I can confirm that one problem is that the script won’t hold the ‘enabled state’in the settings page. Beyond that I cant’t test untill this part works. I would be grateful for some input, but I sympathise with any developer who has to keep up with the constant irritating core changes from wordpress developers. It’s a nightmare maintaining a site with plugins as you never know which ones will break with each wp update. But that’s another subject …

  31. 56
    Richard

    Is there a new release pending to fix the 2.7 compatibility? thanks…

  32. I am on WP ver2.7 too.
    Hoping for a compatible release. Pls.

  33. As others have reported, it looks like DD Post Shift doesn’t work in 2.7. To me it looks like the queries are still good. So I’m guessing it’s related to the cron functionality which I’m not familiar enough with to test.

    Marios

  34. Hello

    Don’t work with WP 2.7 :(

  35. It’s not work on ver 2.7
    Need new release

  36. It’s really great plugin! But it doesn’t work with the newest WP and it is pity. I’m interceding for upgrade.
    Thanks a lot for a good job.
    ====
    Anybody can confirm this information???

  37. The script seems to be disabling itself randomly. It will accept updates of how many hours, and I can Enable/Disable it … but it’s not holding the “Enable” state.

    Hope you can fix this, it’s a great idea.

  38. Thank you ive been looking for something like this. Now I can go on holiday without stressing cheers.

  39. It’s really great plugin! But it doesn’t work with the newest WP and it is pity. I’m interceding for upgrade.
    Thanks a lot for a good job.

  40. I agree – this plugin looks great, but I can’t get it to work on the latest version of WP. Any thoughts (or not) on an update?

    Thanks!

  41. Hi I use this great plugin on one of my older blogs…
    But on my new WP blog it doesnt work :(

    Will there be an update so users with the newest WP can also use it?

    Thanks for the great work mate!

  42. 45
    Martin

    Using Wordpress 2.62 – plugin not working :(

  43. Dyslexia FTL. I meant 1.21.

  44. As an update, I got 2.1 to work on my WP 2.3 site. But not with the category setting…

  45. I also created http://staging.blogcrafted.com and http://staging23.blogcrafted.com to test the plugin (I was planning on making the first anyway). Staging23 runs WP 2.3…seeing if an older wordpress might work. No joy on either of those, they should be rotating every few hours in the “featured” category. As you can see, the posts are handily labeled and timestamped.

    Can you make 1.21 available? The project I want it for doesn’t need multiple category rotation and apparently it used to be working…in fact the person I’d be running it for has a non 2.6 WP anyway.

  46. Yep, no joy for me either on 2.6.3. Does nothing at all.

    Kevin
    retrovision.tv

  47. Is there anything different about 2.6.3 which might have an effect on it? I’m testing the plugin on an old blog of mine (http://madeby.mrsmicah.com) and so far no joy. I initially set them an hour apart to only rotate in 1 category. That didn’t work. Tried 1 hour apart all categories. 3 hours all categories. Nothing.

    The plugin appears to work in that I can activate it, use the interface, etc. It just doesn’t have an effect.

  48. 39
    John

    Great plugin. I’d like to get it to work in conjunction with Scheduled Draft Publish, in that it won’t post shift if there are drafts still available to publish. How’s that sound?

  49. ovidiu: If you stop using the plugin, the posts will be just as they were when you disabled it. It will not go back and change any dates.

    If you only want some posts from a category shifted, the easiest method would be to just add them to a secondary category, and just shift that one.

  50. Version 1.22 has been released

    A bug was fixed in which it was not properly checking for published posts, which would cause the plugin to not rotate posts in newer versions of WordPress.

    The plugin also now supports multiple categories. It can rotate posts from all categories, or just those you specify.

    Special thanks go to Marios for his code fixes and suggestions.

  51. 36
    ovidiu

    also it would be nice, if there was a way to stop certain posts from being recycled this way, even if they are inside the specified category, maybe using a special tag in the post or a custom field

  52. 35
    ovidiu

    just wondering what will happen if one day I decide to stop using the plugin: will all posts shift back to their original post date, or will they just remain shifted?

  53. I’m using WP 2.6, after upload the .php file, I can’t see the plugin to be activate in the plugin admin page.. Is I did anything wrong?
    Thanks..

  54. I am using a WordPress 2.3.1. It can make use of it?

  55. The re-posting doesn’t happen for me if I specify a category ID. All is good if the category ID is blank though. Any thoughts on how I can figure out what’s wrong? I’m using WordPress 2.5.1.

    Thanks!

  56. using plugin my website: http://2009.ater.com.br/

  57. represent our special blog -

    http://saturn.efx2blogs.com/40354/

  58. I cannot understand what the benefit would be for activating such a wordpress plugin. Is there just an idea behind this or is there people or a person that used this with great results. Do not be afraid to share your ideas. We all need to hear… :-)

  59. I was wondering if this plugin is bad for SEO? also if I have a site map does it effect the sitemap also? Thanks for a response

  60. Thanks for the wonderful plugin. This is such a time saver!!

    I was wondering if there is a way to exclude a certain category? Thanks in advance!

  61. Feature suggestion… Rather than restrict posts to just one category, it’d be handy to be able to provide a list of category IDs from which to rotate or to provide a list of categories from which to NOT rotate.

    Very cool plug-in though!

  62. i’m using oldest2newest plugin now and it works pretty good.
    i modified it to included scheduling post in a category.

  63. did a check on the sql code and it seems that one part of it is wrong.
    it should be
    AND {$tp}posts.post_status = ‘publish’
    instead of
    AND {$tp}posts.post_status = ‘published’

    even though i have change to publish, it doesn’t work on 2.5.1 too.

  64. Doesn’t work on my site using Wordpress 2.5.1. Nothing happens.

  65. I love the plugin. I have a site that functions as an online breviary (a book of prayer). It follows a 28 day morning and evening cycle and then repeats. Your plugin is PERFECT for this.

  66. This plugin works great on one site I have, but on two others it simply refuses to rotate any posts once enabled. I believe all 3 sites are WP 2.3+ and use nearly all the same plugins.

    Any ideas on how I could begin to troubleshoot why it would work on one site, but not two others? I realize your time is scarce, any help is appreciated! =)

  67. Yes it does change it can break your links if they are date based, I am trying it with permalinks based upon categories

  68. This may be the ticket for a couple of my sites but I am curious about the URL change. My permanent link will display the date in the URL. Does this change? I would be concerned that anyone that had linked to my permalink would then have a broken link. Here is an example of the permalink for one of my sites:
    http://www.vacationspotscomments.com/2007/09/23/maui-kapalua-bay-resort/

    Note the date. Does this change as the post is recycled to the top of the list?

  69. What happens to the comments posted once its has been reposted

    Could you add a feature which excludes a certain category out of the reposting

    Its a great plugin love it, had to change my permalinks though

    Thanks

  70. I love the plugin. I have a site that functions as an online breviary (a book of prayer). It follows a 28 day morning and evening cycle and then repeats. Your plugin is PERFECT for this. Unfortunately, the RSS feed goes stale after the first cycle. In other words, those folks that have subscribed for over a month don’t get a new feed when the cycle begins anew. Any suggestions?

  71. Thomas: I may actually consider that for a future version. But yes, if you make sure to keep everything unique (plugin name, function names, option names, scheduled items, etc..) you can run more than one copy.

  72. 15
    Thomas

    Hello,
    Would you ever consider making it possible to have multiple schedules for multiple categories? In the meantime, if I wanted to do this w/o much coding skill, do you think it would work for me to copy your plugin, and rename all the references within it that have to be unique, thereby having two ‘copies’ of the plugin runinning at the same time?

  73. Christian: Yes, there are other ways to keep one article ‘on top’, but this is not that kind of plugin.

    Also, like a lot of WordPress plugins, this was not written for WPMU, and will not work with it.

  74. Is there no other WAY to keep an artiel UP? as First one! Problem with this PLUGIN is the RSS FEED! All Feed users get everytime a NEWS two news FEED MESSAGE after ONE NEW ARTICEL IS ON.

    The NEW one and the ONE which should be ON Top!

    And if you use you WP as MULTIBLOG with diffent regions then this plugin is not useable cause you cannon define aticeles in categories to stay on TOP!

  75. Rick: For free plugins and scripts, there is no promised troubleshooting. I get a lot of requests and try to help as many as I can, but I simply do not have the time it would take to troubleshoot everyones situation.

    I am not sure how you can check cron, but there may be some other plugins out there that work with it. I was looking for one myself that would list the current jobs, and allow you to delete them. If there is not one already for that, I may see about creating one eventually.

  76. 11
    Rick

    Thanks for the response!

    I have tried everything from 1 to your default.
    Once I enable it, should it immediately make a change or does it wait for the time period for the first one? I have waited for the time period but I was wondering if there was a quick turn around time for troubleshooting.

    Is there a way I can know if my cron is working or if the problem is with your plugin? Is there another plugin that makes it easy to test the cron?

    Your plugin is just what I need so I am willing to work to get this going!

    Thanks

  77. Rick: I do not believe that wp-cron.php was meant to be ran directly. That is why it does not display anything.

    I am not sure what to suggest as far as troubleshooting. This plugin is my first use of the wp-cron functionality, and creating it was a bit of a learning experience with wp-cron.

    What did you set the delay to in the options?

  78. Installed with 2.1.2 but doesn’t seem to work. Is there a way to troubleshoot this. If I run wp-cron.php directly I get nothing…
    Thanks for any help!

  79. ziranfaze.com: Once again, yes. This is, of course, not a plugin that everyone should install. It was made in particular for certain types of applications, where there is a need to have posts rotated.

  80. then for those readers who have been following our blogs will read the same thing repeatedly? Is this the purpose?

  81. ziranfaze.com: Yes.

  82. Will it affect the rss display? When an old post updated its timestamp, will it show in rss reader as new post?

  83. Miriam: You can choose to only shift posts in a specific category. Perhaps in the future I will make an option to shift all posts except those in a specific category.

  84. Hi, it’s me again (I wrote about your plugin for creating category columns, and asked if it’s possible to do one for links too, which you did!). This is a good plugin since we invest time in posts, and they get lost in the time-space continuum. However, I definitely have written posts that are dated and refer to events or occurrences that were relevant then, but are not relevant in the present. So I wouldn’t want every single one of my posts to reappear. Maybe there is a way to specify posts as dated and omit them from this cycle, i.e. with a custom field or something?

    Just an idea, not a criticism. Thanks!

  85. Christian: This tool does not do a one time placement of an article, it continually takes the oldest (post with the oldest date) article and moves it to the front. It keeps doing this, so posts are cycled.

  86. hmm Great IDEA :) We use Wordpress als CMS for 19 NEWS-Sides. I was looking for a TOOL that handle a TOP-Article(s) for the sides.

    f.e. You habe a HEAD-LINER Article and want it to stay online for 1 DAY! as FIRST ARTICLE! then another writer post a “simple police text message”. Normaly you MEGA 1st artikel is then at pos. 2 and the textmessage is on pos1!

    I think thats the main idea between “Scheduled Post Shift Plugin for WordPress”! But i saw that you cannot enter an ARTICLE ID! to be sheduled! What means “oldest article?”

    better NAME for the TOOL is “SET TOP-Article” :)

Leave a Comment

Before you comment: If you are having an issue with a script, please make sure you have read the entire article. Also, please read through the comments because most common issues have already been discussed many times. Thanks.


Be sure to wrap all code in <code></code> tags.