WordPress: Last Month / Next Month
I was tweaking the site navigation–and I welcome any feedback a reader may have–and I had to grab a plugin to allow me to link to next month / previous month / next year / previous year:
Next Archive Date / Previous Archive Date Plugin from scriptygoddess
I appreciate scriptygoddess’ work, as I’m using her paginate plugin as well. Unfortunately, the example on her site is kind of nasty. So, if someone is casting about on Google, here’s the code in my sidebar template:
<?php if (is_year()): ?> <p><b>By Year</b><br /> <?php previous_archive_date() ?> ... <?php next_archive_date() ?></p> <?php elseif (is_month()): ?> <p><b>Last Month</b><br /> <?php previous_archive_date() ?> <p><b>Next Month</b><br /> <?php next_archive_date() ?></p> <?php endif; ?>
Thanks for the code, Jennifer!