WordPress developers often find themselves frustrated by historical “old” dates, that is, pre-1970 or, in some cases, pre-1969 post and page timestamps. Usually, when developers try to assign such dates to posts, the system ignores them and outputs the current date instead.

Various fixes and workarounds have been proposed in these posts and on the WordPress Trac. And while this particular fix may not work in all server environments — the problem being, at its core, a Unix/PHP limitation — for most developers, it’s likely the easiest and, since it involves no changes to WordPress core files, least obtrusive way to integrate pre-1970/pre-1969 historical, old date timestamps into WordPress posts and pages.

USING THE FUNCTION

In your theme index.php (and/or single.php) file, find any standard WordPress <?php the_time(); ?> or <?php the_date(); ?> function inside the loop. Depending on desired output, characters between the parentheses may vary. For example, a common timestamp function would read <?php the_time('F jS, Y');?> which, if the post/page were published on 1/11/11, would output "January 1st, 2011."

For more date customization options, see the WordPress Codex and the PHP manual. Moreover, while the following function works with both the_time(); and the_date();, for more information on the proper use of each, see the functions’ respective entries in the WordPress Codex:

If you want to adjust this timestamp so WordPress outputs a pre-1960/pre-1970 historical, old date year, delete the year portion of the_time(); and/or the_date(); function — e.g., " … Y);" — and replace it with the following:

Be sure to set your preferred post or page month and day within WordPress’ admin framework. The function will only adjust the year, based on whatever common differential you provide. In the above example, this would be -150 years. This means you’ll want to set your post/page year as many years in the future as required by the differential. For example, again using the above function, if I want a page or post to display a historical old date of 1861, and my common function differential is 150 years, I would give that page or post a publication date of 2011.

Even when using plugins like shacker and rboren‘s “The Future is Now,” some WordPress developers have reported problems with dates beyond 2038. (Strictly speaking, this is another Unix issue and not a WordPress limitation per se.) And, of course, you can only assign publication dates as far back as 1970 or, perhaps, 1969.

As such, if a developer has posts or pages with historical old dates that differ by many hundreds of years, s/he may need to use multiple instances of the function with multiple unique differentials.

Using WordPress conditionals, developers can easily integrate multiple versions of the function into their theme to correspond with different posts and pages and can thereby employ larger or smaller differentials as required.

Quimby started Studio Hyperset in 2006 after studying Transatlantic literature and culture, new media, and humanities computing at the Universities of Georgia (AB, 00) and Nevada, Las Vegas (MA, 03; PhD, 08). Apart from his work with SH, Quimby's published work in Bright Lights Film Journal, SCRIPTjr.nl, hyper/boʊl/e (SH's blog), and elsewhere online.

Essentially, a developer would write his inside-the-loop post or page date function without a year — <?php the_time(‘F jS, ‘);?>, for example (“May 11, “) — and insert something like following beside it:

<?php echo get_post_meta($post->ID, ‘year’, true); ?>

… where “year” is the custom field name.

The final result would look something like this:

<?php the_time(‘F jS, ‘);?>ID, ‘year’, true); ?>

If the developer then gave a post or page a custom field named “year” and a value of, for example, 1776, the final output would look like this: