The New (Possibly Improved) 2CC Emergency Tape Happy Birthday Mike Frame

Scheduled Posts No Longer Appear in “Most Recent Posts”

May 20th, 2006 at 11:49pm

I have finally gotten around to fixing the problem with the “Most Recent Posts” list on the “single post and comments” pages, where posts scheduled for the future would appear in the list, and clicking on the link to them would give you a “404 page not found” error.

Here is what the list looked like on Saturday night before the change.
Blix Recent Post List with Bug

Here is what it looked like after the change.
Blix Recent Post List without Bug

Notice that a bunch of posts are no longer listed…those posts were, at time of the pictures, scheduled for the future.

The problem was caused by an oversight in the “Blix” theme coded by Sebastian Schmieg where he didn’t take into account WordPress’ ability to schedule posts. You see, to schedule a post you have to specify a time in the future for it to appear and then click “Publish” once you are happy with the post.
Setting post timestamp in WordPress

This changes the post’s status from “draft” to “published” in the database, which means that WordPress may show it to you on the blog.

The WordPress dashboard shows a list of recent posts and scheduled posts
Recent and Scheduled posts in WordPress dashboard

This is acheived through code which checks the timestamp of the posts with the current time…much like the blog pages do. Here is the code for the recent posts:
WordPress dashboard recent post code

And here is the code for the scheduled posts:
WordPress dashboard scheduled post code

If you look carefully you will notice that the main difference (other than adding time until post appears to the scheduled posts) is that the “recent posts” section looks for timestamps “< " (less than) the current time, whilst the "scheduled posts" section looks for timestamps ">” (greater than) the current time.

The “variable” $today is defined near the top of this particular PHP script (multiple PHP scripts make up most pages both on the admin interface of WordPress, and on the public blog side of things).
Variable defined in WordPress dashboard code

So here is the code for the “Most Recent Posts” section of the sidebar, I have highlighted the code which I added from the “dashboard”.
Blix Sidebar code without bug


Entry Filed under: Blog News

Print This Post Print This Post


  • 1. randombrainwave  |  May 21st, 2006 at 5:56 pm


  • 2. Samuel  |  May 21st, 2006 at 6:00 pm

    I hope I didn’t bore too many people with that…I just thought people might like to see some of what happens behind the scenes.


May 2006

Most Recent Posts


Blix Theme by Sebastian Schmieg and modified for Samuel's Blog by Samuel Gordon-Stewart.
Printing CSS with the help of Martin Pot's guide to Web Page Printability With CSS.
Icons by Kevin Potts.
Powered by WordPress.
Log in