# I suddenly thought "what do I do about a day with no posts?" as this would break the previous/next day flow by getting redirected to the 404 page.
I know, I should get out more. 😉
First up I had to account for the 404 appearing on a day archive and change the text accordingly.
is_day() function doesn't work on the 404 page so an I needed an alternative way of determining this - running a check against the query is the simplest way:
global $wp_query; $is_date_archive = isset($wp_query->query['day'];
Then I needed to update my footer so that the relevant previous/next links were displayed. Checking against the new
$is_date_archive variable in addition to
is_day() does the trick here.
But, what if the date is in the future?
A quick test to see if the archive date > today and I only display the "Today" link rather than previous/next.