The previous/next day links are in.

It took a bit of fiddling (I'm sure there's probably an easier way to achieve it) but I got there after a bit of trial and error - mostly error 😉

The is_day() function returns true if you are on an archive page showing posts for a day. This makes it nice and easy to isolate day views.

I needed to get the date for the day being viewed, so I could build the links for date +/-1, and pulled this from the WordPress query:

$year     = get_query_var('year');
$monthnum = get_query_var('monthnum');
$day      = get_query_var('day');

This was combined into a single string which was then converted to a date:

$archive_str = $year . '/' . $monthnum . '/' . $day;
$archive_date = strtotime($archive_str);

The strtotime() function is really handy and lets you do relative calculations; getting +/-1 day is simple and these new dates were formatted according to the WordPress archive URL structure making it easy to build the links:

$previous = strtotime('-1 day', $archive_date);
$next = strtotime('+1 day', $archive_date);
$previous = date('Y/m/d', $previous);
$next = date('Y/m/d', $next);

The Today page is, obviously, a little different in that it is not an archive. What I've done here is create one link for 'yesterday' calculated from whatever the day 'today' happens to be:

$today = time();
$yesterday = strtotime('-1 day', $today);
$yesterday = date('Y/m/d', $yesterday);

I have a check elsewhere that sets a variable based on whether there are any posts for 'today' so repurpose this to only show the 'yesterday' link if that is true.