WordPress.org

Make WordPress Core

Opened 9 months ago

Last modified 9 months ago

#40499 new enhancement

the_archive_title() doesn't honour date format setting

Reported by: henry.wright Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Formatting Keywords: close
Focuses: template Cc:

Description

the_archive_title() will output a title such as the following if the current page is a date archive.

Day: April 12, 2017

This date isn't in the format as set in Settings > General.

Change History (4)

#1 follow-up: @johnbillion
9 months ago

  • Component changed from General to Formatting
  • Focuses template added
  • Keywords close added

The date and time format settings have always been a little confusing because they're not actually used in many places in core and in themes.

In this case, the date format is explicitly set to F j, Y as it's a day archive. For month archives it's set to F Y. I don't think it makes sense for the date format setting to be used here.

#2 @henry.wright
9 months ago

Fair enough, John. Thanks for looking.

#3 in reply to: ↑ 1 @knutsp
9 months ago

Replying to johnbillion:

In this case, the date format is explicitly set to F j, Y as it's a day archive. For month archives it's set to F Y. I don't think it makes sense for the date format setting to be used here.

Why not? This is poor internationalisation.

For day archive it should be used. For month, either a special filterable setting or just 'Y-m'.

#4 @johnbillion
9 months ago

The date format is internationalised with _x(), it just doesn't use the value from the Date Format setting.

get_the_date( _x( 'F Y', 'monthly archives date format' ) ) 
Note: See TracTickets for help on using tickets.