fix(post-date): preserve classic theme markup and fix archive titles#4602
Open
rbcorrales wants to merge 2 commits intotrunkfrom
Open
fix(post-date): preserve classic theme markup and fix archive titles#4602rbcorrales wants to merge 2 commits intotrunkfrom
rbcorrales wants to merge 2 commits intotrunkfrom
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adjusts the Post Date feature integration to better match the classic Newspack theme’s historical markup while preventing relative-date formatting from leaking into archive titles.
Changes:
- Switch classic-theme updated-date injection to the new
newspack_theme_posted_onhook and adjust classic updated-date HTML output to match legacy markup. - Prevent
get_the_date“time ago” conversion from applying outside the loop (fixes archive title regressions). - Update the relative-time JS to also target
time.updated[datetime]and remove the plugin’s classic updated-date inline CSS.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
includes/class-post-date.php |
Renames the classic-theme hook, updates classic updated-date markup, removes inline CSS, and adds an in_the_loop() guard in get_the_date filtering. |
src/other-scripts/relative-time/index.js |
Expands the selector to include time.updated[datetime] so classic updated dates get tooltips/updates. |
tests/unit-tests/class-post-date-test.php |
Updates the get_the_date filter test to simulate being “in the loop”. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Open
6 tasks
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
All Submissions:
Changes proposed in this Pull Request:
Follow-up to #4579. Addresses review feedback from @laurelfulford about preserving the classic theme's HTML markup for the updated date, and fixes the archive title regression.
newspack_theme_after_posted_ontonewspack_theme_posted_on(now fires insidenewspack_posted_on()in the theme)<span class="updated-label">+<time class="updated">) matching the old theme markup exactly.updated-date(theme provides.updated-labelstyling)in_the_loop()guard tofilter_get_the_dateto prevent archive titles showing relative dates (e.g. "Daily Archives: 2 days ago")time.updated[datetime]to the relative-time JS selector so the updated date gets a hover tooltip on classic themesRequires companion theme PR: Automattic/newspack-theme#2658. Must ship together.
Closes NPPD-1278.
How to test the changes in this Pull Request:
.posted-onspan:<time class="entry-date published">+<span class="updated-label">Updated </span>+<time class="updated">.data-newspack-modifiedandwp-block-post-date__modified-date.Other information: