We recently launched a site called theforgottenletters.org, an incredible project dedicated to translating the Holocaust-era letters of Ralph Schwab from German to English. While building the site, we needed to archive the letters based on the dates the letters were written, not when we publish them to the site.

First, I tried this tutorial: How To Make a WordPress Events List and calendar plugins, but the tutorial wasn’t comprehensive enough and the plugins were too complex to start messing with.

The solution

I found this wonderful date field plugin which lets  you sort posts by the date entered in the custom fields.  Here’s what I did:

1. Upload the plugin and activate it

2. Opened the lettersarchive.php page template I created and added a query. The query checks for posts in the Letters category that have a date filled in and the orders it from oldest to newest.

<?php query_posts(‘category_name=letters&meta_key=date_value&orderby=meta_value&order=DESC’); ?>

3. I replaced a typical date function within the loop <?php the_time(‘j M Y’); ?> with

<?php echo date(“l jS \of F Y”, get_post_meta($post->ID, ‘date_value’, true));?>

4. I created a new post,  assigned it to the Letters category, and selected a date from the date picker box that now appears below the editing box in the post area.

I noticed that the Date Field plugin only lets you select a date up to 5 years ago  so I had to hack the plugin file on line 125 to  reflect selecting dates from 80 years ago.

for($currentyear = date(‘Y’) – 80; $currentyear <= date(Y) +5;$currentyear +=1)

Here’s a screenshot of the archive from The Forgotten Letters site.

http://www.problogdesign.com/wordpress/how-to-make-a-wordpress-events-list/#comment-16409