Historical dates in Wordpress or another blog system?
May 5, 2011 2:06 PM   Subscribe

Historical dates for blog posts?

Back in the Wordpress 2.6 days, I had a blog of World War II letters where the posts were time-stamped in the 1940s. It was pretty neat until Wordpress 3 came out, breaking it, and its handling of dates no longer worked with these old 20th century years.

I am trying to figure out the best way to write a plugin to handle these old dates, or whether a different CMS like Textpattern would work better with them. My only idea so far is to design a Wordpress custom field that keeps the 1940s dates, but then I wouldn't know how to make Wordpress sort them chronologically, so I am wondering if there is a better approach. Any help much appreciated.
posted by Victorvacendak to Computers & Internet (11 answers total)
My guess is that the easiest thing to do would be to have a custom field for the 1940s date and just have them correspond with actual dates in Wordpress. so a custom field of :

1940 August 12

would have the published date of 2010 August 12

So long as you kept that up, so that

1941 June 4

would be published as 2011 June 4, they should stay in chronological order.
posted by backwards guitar at 2:31 PM on May 5, 2011

Response by poster: Thanks, yeah, I tried that for a little while but still end up with 21st century dates in the Archives...I also should have mentioned I'm trying to make this more straightforward for the user, my dad.
posted by Victorvacendak at 3:08 PM on May 5, 2011

It is not so much a Wordpress failure, as a common PHP problem with dates before 1.1.1970, and thus something you should ask your host about.

Google for 'php dates before 1970', and see myriads of solutions pass by, that all depend on things like which php-libraries the server, and thus the host, is supporting -- something not really possible to clear up here.

but then I wouldn't know how to make Wordpress sort them chronologically,

Something changed in Wordpress 3.0 and 3.1, and that is how a 'custom type' can be used. [Another introduction is given here. It is still all relatively new and not well known].

What this does, basically, is giving more opportunities then ever to use metadata to a post, and order posts by that metadata. So, depending on how many posts you have, or plan to write, a year could become a custom type, and a month of that year a child of that custom type, etcetera.
posted by ijsbrand at 3:48 PM on May 5, 2011

Response by poster: Wow, that is amazing and obscure. I didn't realize Wordpress was becoming so Drupal-ish with custom content types.
posted by Victorvacendak at 4:00 PM on May 5, 2011

The Charles Darwin Diary uses Blogger.
posted by JJ86 at 6:24 AM on May 6, 2011

Can you look into the database and see the way the actual dates are stored? Are they integers or are they actual UTC dates? Is it possible that you still have your data, but that WordPress (both backend and frontend) are too stupid to parse them correctly?
posted by artlung at 10:09 AM on May 6, 2011

Many folks—myself included—have run into this problem. I remember seeing that it was slated to me fixed, but it never has been. The workaround is simple, but has to be reapplied after every update.

In wp-includes, open functions.php. Find this line:

// Sanity check for PHP 5.1.0-

Comment out the if block just below it thusly:

if ( false === $i || intval($i) < 0 ) {
    if ( ! $gmt )
        $i = current_time( 'timestamp' );
        $i = time();
        // we should not let date() interfere with our
        // specially computed timestamp
        $gmt = true;

If you figure out a way to write a plugin to take care of the problem, I'd love it if you me-mailed me about it.
posted by thinman at 10:10 AM on June 2, 2011 [1 favorite]

With the release of WordPress 3.2, historical dates now work as they should.
posted by thinman at 9:49 AM on July 5, 2011

thinman, I'm afraid that isn't true.

As of version 3.2.1, historical dates (and dates far into the future, for that matter) still don't operate as developers would like.

My company's outlined a temporary workaround here, and a full-fledged WordPress plugin is in the works. We'll release it in the next few weeks.
posted by oqm4 at 2:25 PM on July 15, 2011

Historical dates work fine for me under both 3.2 and 3.2.1. I've tested dates in the 100s, 900s, 1200s and early 1900s, and all seem to function properly.
posted by thinman at 2:31 PM on July 20, 2011

We just released the Advanced Dates plugin that will fix this issue:

:: http://wordpress.org/extend/plugins/advanced-dates/
posted by oqm4 at 2:25 AM on September 1, 2011

« Older Scale   |   How to find a Freelance Interactive Producer? Newer »
This thread is closed to new comments.