Repository navigation
General: Show the week in the title of weekly archives. - #15510
DanielFloeter wants to merge 2 commits into
Conversation
Weekly archive links contain both the year and the week (`?m=2025&w=39`), so `is_year()` is true and `get_the_archive_title()` and `wp_get_document_title()` used the year as the title. Add a week branch before the year check in both functions. It uses the same date range as the weekly archive links from `wp_get_archives()`, e.g. "Week: September 22, 2025 – September 28, 2025". See #66489. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
| /** | ||
| * @ticket 66489 | ||
| */ |
There was a problem hiding this comment.
I think this comment/doc is not necessary (it's not used in the rest of the file).
| /** | |
| * @ticket 66489 | |
| */ |
There was a problem hiding this comment.
Thanks! I'd prefer to keep it: per the Core handbook, @ticket marks tests that address a Trac ticket and is mapped to @group, so phpunit --group 66489 runs all tests for this change. It's also already used in this file (@ticket 6479 on test__wp_render_title_tag_with_blog_description).
| public function test_week_title() { | ||
| update_option( 'start_of_week', 1 ); | ||
|
|
||
| $this->go_to( '?m=2015&w=39' ); |
There was a problem hiding this comment.
Can we also test a URL like this: $this->go_to( '/2015?w=39' ); ?
mardelnet
left a comment
There was a problem hiding this comment.
The code changes look good to me.
I'm only adding some optional suggestions/comments.
| date_i18n( $date_format, $week['start'] ), | ||
| date_i18n( $date_format, $week['end'] ) | ||
| ); | ||
| $prefix = _x( 'Week:', 'date archive title prefix' ); |
There was a problem hiding this comment.
This string has to be translated for the different language packs when these changes are merged.
Add a test for `wp_get_document_title()` on `?w=39`, where only the week is set. See #66489. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Weekly archive links contain both the year and the week (
?m=2025&w=39), sois_year()is true andget_the_archive_title()andwp_get_document_title()used the year as the title.Add a week branch before the year check in both functions. It uses the same date range as the weekly archive links from
wp_get_archives(), e.g. "Week: September 22, 2025 – September 28, 2025".See #66489.
Trac ticket: https://core.trac.wordpress.org/ticket/66489
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Implementation and tests drafted with Claude Code; reviewed, tested and adjusted by me.
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.