WordPress V5.0+Template Tag Reference Guide as of Version 5.2
Presented by DBS > Interactive Development :
Date & Time Tags
Get Calendarget_calendar();
Displays the calendar (defaults to current month/year). Days with posts are styled as such. This tag can be used anywhere within a template.
<?php get_calendar($initial); ?>
$initial
Boolean &bull Default: True
(Optional) If true, the day will be displayed using a one-letter initial; if false, an abbreviation based on your localization will be used. False causes "Sunday" to be displayed as "Sun". True causes it to be "S".
Get the Dateget_the_date();
The get_the_date template tag retrieves the date the current $post was written. Unlike the_date() this tag will always return the date. Modify output with 'get_the_date' filter.
<?php get_the_date($d); ?>
$d
String • Default: the date_format option ('Date Format' on Settings > General panel)
(Optional) PHP date format.
Single Month Titlesingle_month_title();
Displays or returns the month and year title for the current page. This tag only works when the m or archive month argument has been passed by WordPress to the current page (this occurs when viewing a monthly archive page). Note: This tag works only on date archive pages, not on category templates or others. It does not support placing the separator after the title, but by leaving the prefix parameter empty, you can set the title separator manually. The prefix does not automatically place a space between the prefix, so if there should be a space, the parameter value will need to have it at the end.
<?php single_month_title($prefix, $display); ?>
$prefix
String • Default: none
(Optional) Text to place before the title.
$display
Boolean • Default: True
(Optional) Display the title (True), or return the title to be used in PHP (False).
The Datethe_date();
Displays or returns the date of a post, or a set of posts if published on the same day. SPECIAL NOTE: When there are multiple posts on a page published under the SAME DAY, the_date() only displays the date for the first post (that is, the first instance of the_date()). To repeat the date for posts published under the same day, you should use the Template Tag the_time() or get_the_date() with a date-specific format string. Use <?php the_time(get_option('date_format')); ?> to add the date set in the admin interface. If you have problems, try removing the quotes around date_format. Both seem to work. This tag must be used within The Loop.
<?php the_date($format, $before, $after, $echo); ?>
$format
String • Default: F j, Y
(Optional) The format for the date. Defaults to the date format configured in your WordPress options.
$before
String • Default: none
(Optional) Text to place before the date.
$after
String • Default: none
(Optional) Text to place after the date.
$echo
Boolean • Default: True
(Optional) Display the date (True), or return the date to be used in PHP (False).
The Date XMLthe_date_xml();
Displays the date of the post in YYYY-MM-DD format (ex: 2004-09-24). This tag must be used within The Loop.
<?php the_date_xml(); ?>
No parameters.
The Modified Authorthe_modified_author();
The author who last modified a post can be displayed by using this Template Tag. This tag must be used within The Loop. Note: the_modified_author was first available with Version 2.8.
<?php the_modified_author(); ?>
No parameters.
The Modified Datethe_modified_date();
This tag displays the date (and time) a post was last modified. This tag works just like the_modified_time(), which also displays the time/date a post was last modified. This tag must be used within The Loop. If no format parameter is specified, the Default date format (please note that says Date format) setting from Administration > Settings > General is used for the display format. If the post or page is not yet modified, the modified date is the same as the creation date. Use get_the_modified_date to retrieve the value.
<?php the_modified_date($d, $before, $after, $echo); ?>
$d
String • Default: date format specified in Administration > Settings > General
(Optional) The format the date is to display in. Defaults to the date format configured in your WordPress settings. See Formatting Date and Time.
$before
String • Default: none
(Optional) Text to place before the date.
$after
String • Default: none
(Optional) Text to place after the date.
$echo
Boolean • Default: true
(Optional) Display the date (true), or return the date to be used in PHP (false).
The Modified Time the_modified_time();
This tag displays the time (and date) a post was last modified and is similar to the functionality of the_time(), which displays the time (and date) a post was created. This tag must be used within The Loop. If no format parameter is specified, the Default date format (please note that says Date format) setting from Administration > Settings > General is used for the display format.
<?php the_modified_time($d); ?>
$d
String • Default: date format specified in Administration > Settings > General
(Optional) The format the date is to display in. Defaults to the date format configured in your WordPress settings. See Formatting Date and Time.
The Time the_time();
Displays the time of the current post. This tag must be used within The Loop.
<?php the_time($d); ?>
$d
String • Default: date format specified in Administration > Settings > General
(Optional) The format the time is to display in. Defaults to the time format configured in your WordPress options. See Formatting Date and Time.
Get Number of Dayscalendar_week_mod();
Get number of days since the start of the week.
<?php calendar_week_mod($num); ?>
$num
Integer (Required) • Default: None
Number of the day.