the_date

SummerySummery

Display or Retrieve the date the current post was written (once per date)

Syntax

the_date( string $format = '', string $before = '', string $after = '', bool $echo = true )

DescriptionDescription

Will only output the date if the current post’s date is different from the previous one output.

i.e. Only one date listing will show per day worth of posts shown in the loop, even if the function is called several times for each post.

HTML output can be filtered with ‘the_date’. Date string output can be filtered with ‘get_the_date’.

ParametersParameters

$format

(string) (Optional) PHP date format defaults to the date_format option if not specified.

Default value: ''

$before

(string) (Optional) Output before the date.

Default value: ''

$after

(string) (Optional) Output after the date.

Default value: ''

$echo

(bool) (Optional) default is display. Whether to echo the date or return it.

Default value: true

ReturnReturn

(string|void) String if retrieving.

SourceSource

File: wp-includes/general-template.php


			

ChangelogChangelog

Changelog
Version Description
0.71 Introduced.
Scroll to Top