Repository navigation
Description
Context
OutdatedPostNotice prepends <p class="mwpd-content-freshness-notice" role="note">…</p> to an outdated post, and the plugin ships no CSS for it. In a default theme the notice looks like the first paragraph of the post. The design critique of the project page (2026-10-24) flagged this as its one blocking issue: the hero shows a styled amber callout that the plugin does not actually produce.
The fix is to ship a small default style, loaded through the asset capability that mwpd/basic-scaffold#37 adds to the scaffold (HasAssets, Style, Script, AssetContext, AssetLocation, Assets/WordPressAssets, InvalidAsset). The use case and the maintainer ruling are on that issue; this plugin is the worked example it was written for.
Scope
- Port the asset capability into
src/Infrastructure/and the architecture rules (PrefixedNamesRuledeclarations and forwarders,CapabilitiesOnServicesRulewithHasAssets,DependencyDirectionRulevalue objects), with the infrastructure tests, fixtures and the API snapshot, renamed to this plugin. OutdatedPostNoticeimplementsHasAssetsand declaresStyle::file( 'mwpd-content-freshness-notice', 'assets/css/notice.css' )at the front-end enqueue point, only when the queried post is outdated. The decision is made in the head, from the queried post and theFreshnessPolicy, not from the loop.assets/css/notice.css: the agreed look (soft amber box, dot marker,emsizing, forced-colors fallback), which the project website mirrors.- README, readme.txt, CHANGELOG (Unreleased) and the docs: the notice has a default style; themes override the class or dequeue the handle.
Out of scope
- Styling in the block editor or admin; the notice only renders on the front end.
- Any other service declaring assets.
- A plugin release or version bump.
- Changes to the scaffold itself. Anything found in the port is reported on infrastructure: scripts and styles as a capability the plugin orchestrates basic-scaffold#37.
Acceptance criteria
- On the front end of a single post that
FreshnessPolicyjudges outdated, themwpd-content-freshness-noticestyle is enqueued atwp_enqueue_scripts, from the plugin's URL, with the main file'sVersion(integration test through the composition root). - On a fresh post, no style is enqueued (test).
- At the admin, block editor and login enqueue points, the notice declares nothing (test).
- On an archive, the service is not needed, so nothing is enqueued and the queried post is not looked at (integration test through the composition root).
- The declared file ships in the plugin (test).
- A failure of the policy while declaring the style surfaces with debug mode on and loads no style with it off (tests).
- The ported infrastructure tests pass;
architecture.prefixedNameschecks the handle inStyle::file(). - README and readme.txt describe the default style and how to restyle or remove it; the architecture walkthrough lists
HasAssets; CHANGELOG has an Unreleased entry. - The end-to-end tests see the stylesheet link on the old post.
Verification
composer test
composer lint
composer check:autoloader
npm run e2eDepends on mwpd/basic-scaffold#37; the infrastructure copy here follows that branch until it merges.
Activity
Port the scaffold's asset capability
Ship a default style for the outdated post notice
Resync the asset capability with the reviewed scaffold branch
Ship a default style for the outdated post notice (#3)
schlessera commentedon Oct 24, 2026
Done in #3 (a4ee1cb). Each acceptance criterion is covered by its tests and the end-to-end checks on WordPress 6.0 and latest, all green on the merged head. The infrastructure it relies on landed upstream in mwpd/basic-scaffold#177.