BACK TO DIRECTORY

Adjacent Archive Links

by Justin Watt

5.0
(2 ratings)

After activating the plugin, you will have two new template tags at your disposal:

<?php previous_archive_link( 'format', 'link' ); ?>
<?php next_archive_link( 'format', 'link' ); ?>

They adapt their output depending on whether the date archive is a day, a month,
or a year, and they will only output a link for an adjacent time period in which you
have published posts. Both tags take two string parameters, format and link.

The format parameter defines what comes before and after the link. In it, %link
will be replaced with whatever is declared in the link parameter below. previous_archive_link
defaults to “&laquo; %link” and next_archive_link defaults to “%link &raquo;“.

The link parameter defines the link text. Both tags default to “%date“, the
adjacent archive page’s localized date.

If you’re interested in contributing to the code behind this plugin, it’s also hosted on GitHub:
https://github.com/justincwatt/wp-adjacent-archive-links

Screenshots

This is an example of how it looks on a date archive page customized to only show post titles in chronological order.

This is an example of how it looks on a date archive page customized to only show post titles in chronological order.

Plugin Details

Active Installs
10
Total Downloads
3,357
Version
3.0
Requires WP
3.0
Requires PHP
Tested Up To
4.2.39
Added
2012-11-26
Last Updated
2015-05-18 12:24am GMT

Ratings

5
2
4
0
3
0
2
0
1
0