Make WordPress Core

Opened 7 years ago

Closed 14 months ago

#8532 closed defect (bug) (invalid)

the_date() doesn't function as intended

Reported by: matt Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Date/Time Keywords:
Focuses: template Cc:


If my memory serves the idea behind the_date was that it would echo out the date, but only if it was different than the previous item it echoed out in the loop, which would be handy for doing things like day headers in index templates or month headers in archives.

At some point this seems to have been lost, I think because some variable names changed.

This restores the_date to its original behaviour.

Attachments (2)

the_date.diff (1.4 KB) - added by matt 7 years ago.
8532.002.diff (1.4 KB) - added by markjaquith 7 years ago.

Download all attachments as: .zip

Change History (15)

7 years ago

7 years ago

#1 @markjaquith
7 years ago

Refreshed the patch. FWIW, I'm not sure this was ever the way it functioned. I think it's always functioned that it'd echo out only for new days, not a change in output. I do, however, think that what you've proposed is useful.

#2 @MichaelH
7 years ago

This note at http://codex.wordpress.org/Template_Tags/the_date is the premise we've used for a number of years in answering questions in the Forums:

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() with a date-specific format string.

#3 @westi
7 years ago

New days only is what my memory tells me this did.

And is how I have always explained it to people.

#4 @Denis-de-Bernardy
7 years ago

  • Keywords has-patch added

#5 @Denis-de-Bernardy
7 years ago

  • Keywords needs-patch added; has-patch removed
  • Milestone changed from 2.8 to Future Release

broken patch

#6 @Denis-de-Bernardy
6 years ago

  • Milestone changed from Future Release to 2.8.1

#7 @ryan
6 years ago

  • Milestone changed from 2.8.1 to 2.9

#8 @westi
6 years ago

  • Milestone changed from 2.9 to Future Release

Moving to Future until this has a new patch.

#9 @wojtek.szkutnik
5 years ago

  • Keywords gsoc added

#11 @nacin
22 months ago

  • Component changed from Template to Date/Time
  • Focuses template added

#12 @obenland
19 months ago

  • Keywords close added; needs-patch gsoc removed

the_date() works as ticket descriptions suggests, it echoes out the date, but only if it was different than the previous item it echoed out in the loop.

I'm not sure I can recreate any faulty behavior from five years ago, but I wonder if r16303 did not fix whatever when wrong back then. Suggesting to close as invalid.

#13 @obenland
14 months ago

  • Keywords close removed
  • Milestone Future Release deleted
  • Resolution set to invalid
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.