is_day()

Description

The is_day() conditional tag is used to determine if the current page is a daily archive. This tag may be used in a template file to achieve special formatting for daily archives vs. monthly or yearly archives. The is_day() call does not have to be within the Loop.

Syntax


is_day()

Parameters

This function has no parameters.

Return Value

boolean
  • true if current page is a daily archive
  • false if current page is not a daily archive

Examples

Test to Determine Date Archive Timeframe

The following code fragment will display Browsing daily archive for June 4, 2013 if the current page is a daily archive page and the selected date is 6/4/13.

if (is_day())
	echo "<p>Browsing daily archive for ",
	     get_the_time('F j, Y'), "</p>\n";
elseif (is_month())
	echo "<p>Browsing monthly archive for ",
	     get_the_time('F Y'), "</p>\n";
elseif (is_year())
	echo "<p>Browsing yearly archive for ",
	     get_the_time('Y'), "</p>\n";
else
	echo "<p>Unable to determine date archive timeframe</p>\n";

This code might be used in the date.php template prior to the Loop.

References