27 Jun, 2004
Previous Archive Date / Next Archive Date links
Posted by: Jennifer In: WordPress Plugins
This plugin will allow you to put next / previous links for date archive pages. For example, you're looking at the archive page for "January 7, 2004" – it will put a link to the previous day and next day page. If there are no posts on that day – it will look for the next available day that has posts. So in our example – if we had posts on January 6, January 7 (the page we're looking at) and there wasn't another post until January 10. Calling the two functions in this plugin, you could do this:
« January 6, 2004 | Home | January 10, 2004 »
Current Version: v 2.0
Last updated: 11/04/04 10:10pm
Installation Instructions:
Step 1: Download and activate this plugin in the plugin control panel in wordpress
IMPORTANT NOTE ABOUT DOWNLOAD: Make sure you do NOT have any extra spaces after the last ?> in your copy of the file. Extra spaces will give you various "header already sent" type errors.
Step 2:You can now use the two following functions:
previous_archive_date()
next_archive_date()
Each function will take two (optional) strings passed to it. The first string is text or html to display before the link. The second is the text or html to display after the link. Default for both of these is blank. So:
previous_archive_date($before=", $after=")
next_archive_date($before=", $after=")
To achieve the original example – place this code OUTSITE the start of the WP loop, with the following surrounding code (so the "home" link doesn't display unless we're looking at a date archive page) :
<?php if (isset($_GET['m']) || (isset($_GET['year']) && !($single))) { ?>
<p><?php previous_archive_date('« ',' |'); ?> <a href="<?php bloginfo('url'); ?>">Home</a> <?php next_archive_date('| ',' »') ?></p>
<?php } ?>
Change Log
New in ver 2.0:
Let's give that permalink support another try, shall we?!
get_year_link function thanks go to Charles G. of blindmuse.com
Localization support.
Streamlined code.
Support for up2date plugin
New in ver 1.0:
Now works with permalinks. Many many bugs fixed.
UPDATE 11/26/2012
I was contacted by a reader that they've recently taken this idea and updated it and made a plugin out of it. More info can be found here:
Adjacent Archive Links for WordPress
The plugin can be found here: Adjacent Archive Links Plugin