From a4c68e3c564f298a72ed30688d1be0bef0294a87 Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Fri, 14 Aug 2026 19:05:48 -0500 Subject: [PATCH 1/3] chore: run the local environment on WordPress 7.0.4 Production upgraded to 7.0.4, so the development and test containers now match it instead of trailing on 6.9.6. The full suite passes unchanged against the new core, and the pinned assertion moves with it. Co-Authored-By: Claude Opus 5 (1M context) --- .wp-env.json | 2 +- tests/smoke/project-config.test.mjs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.wp-env.json b/.wp-env.json index 8c81de8..52d2bfa 100644 --- a/.wp-env.json +++ b/.wp-env.json @@ -1,6 +1,6 @@ { "$schema": "https://schemas.wp.org/trunk/wp-env.json", - "core": "https://wordpress.org/wordpress-6.9.6.zip", + "core": "https://wordpress.org/wordpress-7.0.4.zip", "phpVersion": "8.3", "autoPort": false, "port": 8888, diff --git a/tests/smoke/project-config.test.mjs b/tests/smoke/project-config.test.mjs index ae6235e..59e1661 100644 --- a/tests/smoke/project-config.test.mjs +++ b/tests/smoke/project-config.test.mjs @@ -12,7 +12,7 @@ test('tooling is pinned and wp-env maps this repo as chrnx', async () => { assert.equal(pkg.devDependencies['@wordpress/scripts'], '34.0.0'); assert.equal(pkg.devDependencies['@playwright/test'], '1.62.1'); assert.equal(pkg.devDependencies.lighthouse, '13.4.1'); - assert.equal(env.core, 'https://wordpress.org/wordpress-6.9.6.zip'); + assert.equal(env.core, 'https://wordpress.org/wordpress-7.0.4.zip'); assert.equal(env.phpVersion, '8.3'); assert.equal(env.autoPort, false); assert.equal(env.port, 8888); From 0a90e7878329cf9ec2ef8071f3b063cedf1268ab Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Fri, 14 Aug 2026 19:05:55 -0500 Subject: [PATCH 2/3] fix: declare the language each post is actually written in Half the journal is Spanish, but every route declared en-US, so screen readers pronounced Spanish posts with English phonetics and crawlers indexed them as English. The chrnx_language taxonomy already recorded the answer per post and nothing read it. Map its terms onto the html lang attribute for single posts and for the language archives, replacing only the language so dir and any plugin attribute survive. Posts with no language term keep the site default. Also stop advertising a comments feed. Comments are unsupported theme-wide, yet the head still linked one, because feed_links_extra also fires for old posts carrying a non-zero comment_count. The core filter covers both that and the site-wide link while leaving topic, author and search feeds alone. Co-Authored-By: Claude Opus 5 (1M context) --- inc/setup.php | 56 ++++++++++++++++++++++++++ tests/php/ThemeSetupTest.php | 77 ++++++++++++++++++++++++++++++++++++ 2 files changed, 133 insertions(+) diff --git a/inc/setup.php b/inc/setup.php index 1e09e8b..e14eef0 100644 --- a/inc/setup.php +++ b/inc/setup.php @@ -32,6 +32,62 @@ function chrnx_setup() { add_action( 'after_setup_theme', 'chrnx_setup' ); add_filter( 'comments_open', '__return_false' ); +/* + * Nothing collects comments, so the head must not advertise a feed for them. + * This one filter covers both the site-wide feed printed by feed_links() and + * the per-post one from feed_links_extra(), which still fired on old posts + * carrying a non-zero comment_count. Topic, author and search feeds stay. + */ +add_filter( 'feed_links_show_comments_feed', '__return_false' ); + +/** + * Resolve the document language from the editorial language taxonomy. + * + * Roughly half the journal is written in Spanish while every route declared + * en-US, so screen readers read Spanish with English phonetics and crawlers + * indexed those posts as English. chrnx_language already records the answer. + * + * @return string BCP 47 tag, or an empty string to keep the site language. + */ +function chrnx_get_document_locale(): string { + // ponytail: explicit map, a third language is one more line here. + $locales = array( + 'en' => 'en-US', + 'es' => 'es-MX', + ); + + $slug = ''; + + if ( is_singular( 'post' ) ) { + // A post carries one language; extra terms are an editing mistake. + $terms = get_the_terms( get_queried_object_id(), 'chrnx_language' ); + $slug = ( is_array( $terms ) && isset( $terms[0]->slug ) ) ? $terms[0]->slug : ''; + } elseif ( is_tax( 'chrnx_language' ) ) { + $term = get_queried_object(); + $slug = $term instanceof WP_Term ? $term->slug : ''; + } + + return $locales[ $slug ] ?? ''; +} + +/** + * Apply the editorial language to the html element. + * + * @param string $output Attribute string built by core. + * @return string Attribute string carrying the editorial language. + */ +function chrnx_filter_language_attributes( $output ) { + $locale = chrnx_get_document_locale(); + + if ( '' === $locale ) { + return $output; + } + + // Replace only the language, so dir and any plugin attribute survive. + return preg_replace( '/lang="[^"]*"/', 'lang="' . esc_attr( $locale ) . '"', (string) $output, 1 ); +} +add_filter( 'language_attributes', 'chrnx_filter_language_attributes' ); + /** * Print Open Graph and Twitter card tags only when nothing else does. * diff --git a/tests/php/ThemeSetupTest.php b/tests/php/ThemeSetupTest.php index 5c29bf9..0c3e82b 100644 --- a/tests/php/ThemeSetupTest.php +++ b/tests/php/ThemeSetupTest.php @@ -37,6 +37,83 @@ class ThemeSetupTest extends WP_UnitTestCase { $this->assertContains( 'assets/css/components.css', $editor_styles ); } + /** + * Ensure a Spanish post declares a Spanish document language. + */ + public function test_language_attributes_follow_a_spanish_post() { + $post_id = self::factory()->post->create(); + wp_set_object_terms( $post_id, 'es', 'chrnx_language' ); + + $this->go_to( get_permalink( $post_id ) ); + + $this->assertTrue( is_singular( 'post' ) ); + $this->assertSame( 'lang="es-MX"', chrnx_filter_language_attributes( 'lang="en-US"' ) ); + } + + /** + * Ensure an English post keeps the English document language. + */ + public function test_language_attributes_follow_an_english_post() { + $post_id = self::factory()->post->create(); + wp_set_object_terms( $post_id, 'en', 'chrnx_language' ); + + $this->go_to( get_permalink( $post_id ) ); + + $this->assertSame( 'lang="en-US"', chrnx_filter_language_attributes( 'lang="en-US"' ) ); + } + + /** + * Ensure the direction attribute survives the language swap. + */ + public function test_language_attributes_preserve_other_attributes() { + $post_id = self::factory()->post->create(); + wp_set_object_terms( $post_id, 'es', 'chrnx_language' ); + + $this->go_to( get_permalink( $post_id ) ); + + $this->assertSame( 'lang="es-MX" dir="ltr"', chrnx_filter_language_attributes( 'lang="en-US" dir="ltr"' ) ); + } + + /** + * Ensure a post without a language term is left untouched. + */ + public function test_language_attributes_ignore_a_post_without_a_language() { + $post_id = self::factory()->post->create(); + + $this->go_to( get_permalink( $post_id ) ); + + $this->assertSame( 'lang="en-US"', chrnx_filter_language_attributes( 'lang="en-US"' ) ); + } + + /** + * Ensure a language archive declares the language it lists. + */ + public function test_language_attributes_follow_a_language_archive() { + $post_id = self::factory()->post->create(); + wp_set_object_terms( $post_id, 'es', 'chrnx_language' ); + + $this->go_to( get_term_link( 'es', 'chrnx_language' ) ); + + $this->assertTrue( is_tax( 'chrnx_language' ) ); + $this->assertSame( 'lang="es-MX"', chrnx_filter_language_attributes( 'lang="en-US"' ) ); + } + + /** + * Ensure the home page keeps the site language. + */ + public function test_language_attributes_leave_the_home_page_alone() { + $this->go_to( home_url( '/' ) ); + + $this->assertSame( 'lang="en-US"', chrnx_filter_language_attributes( 'lang="en-US"' ) ); + } + + /** + * Ensure the head never advertises a comments feed the theme cannot render. + */ + public function test_comments_feed_is_not_advertised() { + $this->assertFalse( apply_filters( 'feed_links_show_comments_feed', true ) ); + } + /** * Ensure the local base stylesheet is enqueued with the theme version. */ From 32dc1c3e86575beb0580d17972999a33fde6757b Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Fri, 14 Aug 2026 19:05:58 -0500 Subject: [PATCH 3/3] chore: release 0.4.4 Co-Authored-By: Claude Opus 5 (1M context) --- blocks/featured-stories/block.json | 2 +- blocks/footer-content/block.json | 2 +- blocks/header-tools/block.json | 2 +- blocks/journal-link/block.json | 2 +- blocks/journal-stream/block.json | 2 +- blocks/latest-podcast/block.json | 2 +- blocks/mobile-menu-toggle/block.json | 2 +- blocks/podcast-meta/block.json | 2 +- blocks/reading-time/block.json | 2 +- blocks/related-posts/block.json | 2 +- blocks/release-detail/block.json | 2 +- blocks/release-list/block.json | 2 +- blocks/selected-work/block.json | 2 +- blocks/show-links/block.json | 2 +- blocks/site-brand/block.json | 2 +- blocks/subscribe-cta/block.json | 2 +- blocks/subscribe-form/block.json | 2 +- blocks/theme-toggle/block.json | 2 +- blocks/topic-hero/block.json | 2 +- blocks/track-meta/block.json | 2 +- functions.php | 2 +- style.css | 2 +- 22 files changed, 22 insertions(+), 22 deletions(-) diff --git a/blocks/featured-stories/block.json b/blocks/featured-stories/block.json index e189c95..b38c9a5 100644 --- a/blocks/featured-stories/block.json +++ b/blocks/featured-stories/block.json @@ -2,7 +2,7 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "chrnx/featured-stories", - "version": "0.4.3", + "version": "0.4.4", "title": "Featured Stories", "category": "theme", "description": "A sticky-led selection of topic-diverse stories.", diff --git a/blocks/footer-content/block.json b/blocks/footer-content/block.json index 613b519..d7cc2db 100644 --- a/blocks/footer-content/block.json +++ b/blocks/footer-content/block.json @@ -2,7 +2,7 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "chrnx/footer-content", - "version": "0.4.3", + "version": "0.4.4", "title": "CHRNX Footer Content", "category": "theme", "description": "Display translated internal footer navigation and site credit.", diff --git a/blocks/header-tools/block.json b/blocks/header-tools/block.json index 975e12f..46bda30 100644 --- a/blocks/header-tools/block.json +++ b/blocks/header-tools/block.json @@ -2,7 +2,7 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "chrnx/header-tools", - "version": "0.4.3", + "version": "0.4.4", "title": "CHRNX Header Tools", "category": "theme", "description": "Display translated primary navigation and progressive site search.", diff --git a/blocks/journal-link/block.json b/blocks/journal-link/block.json index 38f2c51..64c4f9c 100644 --- a/blocks/journal-link/block.json +++ b/blocks/journal-link/block.json @@ -2,7 +2,7 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "chrnx/journal-link", - "version": "0.4.3", + "version": "0.4.4", "title": "Journal Link", "category": "theme", "description": "Display a translated portable link to the full Journal.", diff --git a/blocks/journal-stream/block.json b/blocks/journal-stream/block.json index b3f6436..7c2f728 100644 --- a/blocks/journal-stream/block.json +++ b/blocks/journal-stream/block.json @@ -2,7 +2,7 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "chrnx/journal-stream", - "version": "0.4.3", + "version": "0.4.4", "title": "Journal Stream", "category": "theme", "description": "The filterable chronological journal.", diff --git a/blocks/latest-podcast/block.json b/blocks/latest-podcast/block.json index f46aa8d..aa67bd1 100644 --- a/blocks/latest-podcast/block.json +++ b/blocks/latest-podcast/block.json @@ -2,7 +2,7 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "chrnx/latest-podcast", - "version": "0.4.3", + "version": "0.4.4", "title": "Latest Podcast", "category": "theme", "description": "A linked card for the latest podcast episode.", diff --git a/blocks/mobile-menu-toggle/block.json b/blocks/mobile-menu-toggle/block.json index 72f5b8e..e5c6e30 100644 --- a/blocks/mobile-menu-toggle/block.json +++ b/blocks/mobile-menu-toggle/block.json @@ -2,7 +2,7 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "chrnx/mobile-menu-toggle", - "version": "0.4.3", + "version": "0.4.4", "title": "CHRNX Mobile Menu Toggle", "category": "theme", "description": "Progressively reveal the primary navigation on small screens.", diff --git a/blocks/podcast-meta/block.json b/blocks/podcast-meta/block.json index 2149421..5693ccd 100644 --- a/blocks/podcast-meta/block.json +++ b/blocks/podcast-meta/block.json @@ -2,7 +2,7 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "chrnx/podcast-meta", - "version": "0.4.3", + "version": "0.4.4", "title": "Podcast Metadata", "category": "theme", "description": "Safe episode details for the current post.", diff --git a/blocks/reading-time/block.json b/blocks/reading-time/block.json index 87bc07b..0872e15 100644 --- a/blocks/reading-time/block.json +++ b/blocks/reading-time/block.json @@ -2,7 +2,7 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "chrnx/reading-time", - "version": "0.4.3", + "version": "0.4.4", "title": "Reading Time", "category": "theme", "description": "Display a localized estimate based on the current post content.", diff --git a/blocks/related-posts/block.json b/blocks/related-posts/block.json index b3ed913..d9430c4 100644 --- a/blocks/related-posts/block.json +++ b/blocks/related-posts/block.json @@ -2,7 +2,7 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "chrnx/related-posts", - "version": "0.4.3", + "version": "0.4.4", "title": "Related Posts", "category": "theme", "description": "Related stories selected by topic, tags, and recency.", diff --git a/blocks/release-detail/block.json b/blocks/release-detail/block.json index 02afd90..20eabf4 100644 --- a/blocks/release-detail/block.json +++ b/blocks/release-detail/block.json @@ -2,7 +2,7 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "chrnx/release-detail", - "version": "0.4.3", + "version": "0.4.4", "title": "Release Detail", "category": "theme", "description": "Album cover, listening links, and the ordered tracklist.", diff --git a/blocks/release-list/block.json b/blocks/release-list/block.json index d356bab..048027d 100644 --- a/blocks/release-list/block.json +++ b/blocks/release-list/block.json @@ -2,7 +2,7 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "chrnx/release-list", - "version": "0.4.3", + "version": "0.4.4", "title": "Release List", "category": "theme", "description": "The No Names releases, each linking to its album page.", diff --git a/blocks/selected-work/block.json b/blocks/selected-work/block.json index f76b64d..19a0deb 100644 --- a/blocks/selected-work/block.json +++ b/blocks/selected-work/block.json @@ -2,7 +2,7 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "chrnx/selected-work", - "version": "0.4.3", + "version": "0.4.4", "title": "Selected Work", "category": "theme", "description": "Hand-picked projects first, then the most recent ones.", diff --git a/blocks/show-links/block.json b/blocks/show-links/block.json index 87e1d05..ef1a218 100644 --- a/blocks/show-links/block.json +++ b/blocks/show-links/block.json @@ -2,7 +2,7 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "chrnx/show-links", - "version": "0.4.3", + "version": "0.4.4", "title": "Show Links", "category": "theme", "description": "Where a podcast show can be listened to, rendered only when a URL exists.", diff --git a/blocks/site-brand/block.json b/blocks/site-brand/block.json index 26b6a5e..fad54b0 100644 --- a/blocks/site-brand/block.json +++ b/blocks/site-brand/block.json @@ -2,7 +2,7 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "chrnx/site-brand", - "version": "0.4.3", + "version": "0.4.4", "title": "CHRNX Site Brand", "category": "theme", "description": "Display the local CHRNX wordmark linked to the site home.", diff --git a/blocks/subscribe-cta/block.json b/blocks/subscribe-cta/block.json index 3255227..03b0feb 100644 --- a/blocks/subscribe-cta/block.json +++ b/blocks/subscribe-cta/block.json @@ -2,7 +2,7 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "chrnx/subscribe-cta", - "version": "0.4.3", + "version": "0.4.4", "title": "Subscribe CTA", "category": "theme", "description": "A call to action linked to the configured subscribe page.", diff --git a/blocks/subscribe-form/block.json b/blocks/subscribe-form/block.json index e86f467..fb3269c 100644 --- a/blocks/subscribe-form/block.json +++ b/blocks/subscribe-form/block.json @@ -2,7 +2,7 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "chrnx/subscribe-form", - "version": "0.4.3", + "version": "0.4.4", "title": "Subscribe Form", "category": "theme", "description": "The email subscription form, rendered only when a provider endpoint is configured.", diff --git a/blocks/theme-toggle/block.json b/blocks/theme-toggle/block.json index 1228f2d..ce574c5 100644 --- a/blocks/theme-toggle/block.json +++ b/blocks/theme-toggle/block.json @@ -2,7 +2,7 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "chrnx/theme-toggle", - "version": "0.4.3", + "version": "0.4.4", "title": "Theme Toggle", "category": "theme", "description": "Choose a light, dark, or system color theme.", diff --git a/blocks/topic-hero/block.json b/blocks/topic-hero/block.json index 067fe1d..9746f35 100644 --- a/blocks/topic-hero/block.json +++ b/blocks/topic-hero/block.json @@ -2,7 +2,7 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "chrnx/topic-hero", - "version": "0.4.3", + "version": "0.4.4", "title": "Topic Hero", "category": "theme", "description": "A fixed-art hero for an editorial topic.", diff --git a/blocks/track-meta/block.json b/blocks/track-meta/block.json index 1a843b3..3c18c18 100644 --- a/blocks/track-meta/block.json +++ b/blocks/track-meta/block.json @@ -2,7 +2,7 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "chrnx/track-meta", - "version": "0.4.3", + "version": "0.4.4", "title": "Track Meta", "category": "theme", "description": "Player, listening links, and album for one song.", diff --git a/functions.php b/functions.php index 7c977d8..6bc4749 100644 --- a/functions.php +++ b/functions.php @@ -1,5 +1,5 @@