From 995bb9e1cd3525887904e19bd77fda4297a4eec1 Mon Sep 17 00:00:00 2001 From: Olivier Gorzalka Date: Tue, 29 Sep 2026 16:31:41 +0200 Subject: [PATCH] refactor: static patterns as native WordPress patterns, at the theme root MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The theme root now holds what WordPress reads itself (templates/, parts/, patterns/, theme.json, style.css) and resources/views/ holds Blade only. The six static patterns move from resources/views/patterns/*.html to patterns/*.php, the format WordPress registers natively and the Site Editor exports; the colophon, which needs PHP for the year, stays a Blade pattern. This also makes the theme work on a released framework: the .html patterns needed an unreleased framework change, so on v13.32.0-beta.9 no pattern rendered — no masthead, no index, no article. --- README.md | 33 ++++++++++++------- .../article.html => patterns/article.php | 14 ++++---- .../design-system.php | 14 ++++---- .../index-list.php | 14 ++++---- .../masthead.html => patterns/masthead.php | 16 +++++---- .../not-found.html => patterns/not-found.php | 14 ++++---- .../page-body.html => patterns/page-body.php | 14 ++++---- 7 files changed, 71 insertions(+), 48 deletions(-) rename resources/views/patterns/article.html => patterns/article.php (96%) rename resources/views/patterns/design-system.html => patterns/design-system.php (98%) rename resources/views/patterns/index-list.html => patterns/index-list.php (93%) rename resources/views/patterns/masthead.html => patterns/masthead.php (84%) rename resources/views/patterns/not-found.html => patterns/not-found.php (87%) rename resources/views/patterns/page-body.html => patterns/page-body.php (85%) diff --git a/README.md b/README.md index 37a76c1..cf85a6b 100644 --- a/README.md +++ b/README.md @@ -27,13 +27,15 @@ buzz/ │ ├── page.html │ └── 404.html ├── parts/ # header.html / footer.html, each delegating to a pattern too +├── patterns/ # Static patterns, registered by WordPress itself +│ ├── masthead.php # The actual header markup +│ ├── index-list.php # The journal index: a post loop, large titles, hairline rules +│ ├── article.php # A single post's body, plus comments +│ ├── page-body.php # A plain page's body +│ ├── not-found.php # The 404 message +│ └── design-system.php # Every native block, styled — offered in the inserter ├── resources/views/patterns/ -│ ├── masthead.html # The actual header markup — no PHP needed -│ ├── colophon.blade.php # The footer — Blade, for the one thing that needs real PHP: the year -│ ├── index-list.html # The journal index: a post loop, large titles, hairline rules -│ ├── article.html # A single post's body, plus comments -│ ├── page-body.html # A plain page's body -│ └── not-found.html # The 404 message +│ └── colophon.blade.php # The footer — Blade, for the one thing that needs real PHP: the year ├── theme.json # The design system: palette, the two-family type scale, spacing, styles ├── resources/assets/ │ ├── css/app.css # @theme static tokens (colour only — see below) + the few hand-authored rules @@ -41,10 +43,19 @@ buzz/ └── app/Providers/AssetServiceProvider.php ``` -A theme's `resources/views/patterns` can hold both `.blade.php` (compiled, for real PHP) and plain -`.html` files (used verbatim, for a pattern that needs none) — most of Buzz's patterns are plain -`.html`, since a block theme's patterns are mostly static block markup once the dynamic blocks -(`post-title`, `post-content`, `post-terms`…) are doing the work themselves. +One rule decides where a file goes: **the theme root holds what WordPress reads itself** +(`templates/`, `parts/`, `patterns/`, `theme.json`, `style.css` — the layout the Site Editor exports +too), and **`resources/views/` holds Blade, compiled by Pollora**. + +So a static pattern is a native WordPress one, `patterns/*.php`: block markup under a header +docblock (`Title`, `Slug`, `Categories`…). Most of Buzz's patterns are, since the dynamic blocks +(`post-title`, `post-content`, `post-terms`…) do the work themselves. A pattern that needs Laravel +— the colophon's year, here — is a Blade view in `resources/views/patterns/*.blade.php`, registered +by Pollora. + +WordPress caches the list of a theme's `patterns/` files: a new file shows up once that cache is +cleared (`wp eval 'wp_get_theme()->delete_pattern_cache();'`), or at once with +`WP_DEVELOPMENT_MODE=theme`. ## Design system @@ -82,4 +93,4 @@ mismatch there breaks every asset and font URL silently. A first, deliberately simple version: six templates, six patterns, no style variations. See [`Pollora/framework`](https://github.com/Pollora/framework) for the FSE support this theme relies on, and the framework's changelog for the two fixes this theme's construction found and fixed -(`.html` block patterns, a block theme's `404.html` answering the right HTTP status). +(a block theme's `404.html` answering the right HTTP status, its `error404` body class). diff --git a/resources/views/patterns/article.html b/patterns/article.php similarity index 96% rename from resources/views/patterns/article.html rename to patterns/article.php index 6f948d2..943e2d5 100644 --- a/resources/views/patterns/article.html +++ b/patterns/article.php @@ -1,9 +1,11 @@ - +
diff --git a/resources/views/patterns/design-system.html b/patterns/design-system.php similarity index 98% rename from resources/views/patterns/design-system.html rename to patterns/design-system.php index 3b14ebc..e60c674 100644 --- a/resources/views/patterns/design-system.html +++ b/patterns/design-system.php @@ -1,9 +1,11 @@ - +
diff --git a/resources/views/patterns/index-list.html b/patterns/index-list.php similarity index 93% rename from resources/views/patterns/index-list.html rename to patterns/index-list.php index 1c9ec1c..1d981e0 100644 --- a/resources/views/patterns/index-list.html +++ b/patterns/index-list.php @@ -1,9 +1,11 @@ - +
diff --git a/resources/views/patterns/masthead.html b/patterns/masthead.php similarity index 84% rename from resources/views/patterns/masthead.html rename to patterns/masthead.php index f9ad5b9..c3bab7c 100644 --- a/resources/views/patterns/masthead.html +++ b/patterns/masthead.php @@ -1,10 +1,12 @@ - +
diff --git a/resources/views/patterns/not-found.html b/patterns/not-found.php similarity index 87% rename from resources/views/patterns/not-found.html rename to patterns/not-found.php index 2a44c3c..a01ae65 100644 --- a/resources/views/patterns/not-found.html +++ b/patterns/not-found.php @@ -1,9 +1,11 @@ - +
diff --git a/resources/views/patterns/page-body.html b/patterns/page-body.php similarity index 85% rename from resources/views/patterns/page-body.html rename to patterns/page-body.php index c8bdd61..d220b58 100644 --- a/resources/views/patterns/page-body.html +++ b/patterns/page-body.php @@ -1,9 +1,11 @@ - +