Compare commits

...
4 Commits
Author SHA1 Message Date
chrnxandClaude Opus 5 9fed24c09a Merge branch 'fix/document-language'
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-14 19:06:02 -05:00
chrnxandClaude Opus 5 32dc1c3e86 chore: release 0.4.4
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-14 19:05:58 -05:00
chrnxandClaude Opus 5 0a90e78783 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) <noreply@anthropic.com>
2026-08-14 19:05:55 -05:00
chrnxandClaude Opus 5 a4c68e3c56 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) <noreply@anthropic.com>
2026-08-14 19:05:48 -05:00
26 changed files with 157 additions and 24 deletions

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"$schema": "https://schemas.wp.org/trunk/wp-env.json", "$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", "phpVersion": "8.3",
"autoPort": false, "autoPort": false,
"port": 8888, "port": 8888,
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json", "$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3, "apiVersion": 3,
"name": "chrnx/featured-stories", "name": "chrnx/featured-stories",
"version": "0.4.3", "version": "0.4.4",
"title": "Featured Stories", "title": "Featured Stories",
"category": "theme", "category": "theme",
"description": "A sticky-led selection of topic-diverse stories.", "description": "A sticky-led selection of topic-diverse stories.",
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json", "$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3, "apiVersion": 3,
"name": "chrnx/footer-content", "name": "chrnx/footer-content",
"version": "0.4.3", "version": "0.4.4",
"title": "CHRNX Footer Content", "title": "CHRNX Footer Content",
"category": "theme", "category": "theme",
"description": "Display translated internal footer navigation and site credit.", "description": "Display translated internal footer navigation and site credit.",
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json", "$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3, "apiVersion": 3,
"name": "chrnx/header-tools", "name": "chrnx/header-tools",
"version": "0.4.3", "version": "0.4.4",
"title": "CHRNX Header Tools", "title": "CHRNX Header Tools",
"category": "theme", "category": "theme",
"description": "Display translated primary navigation and progressive site search.", "description": "Display translated primary navigation and progressive site search.",
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json", "$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3, "apiVersion": 3,
"name": "chrnx/journal-link", "name": "chrnx/journal-link",
"version": "0.4.3", "version": "0.4.4",
"title": "Journal Link", "title": "Journal Link",
"category": "theme", "category": "theme",
"description": "Display a translated portable link to the full Journal.", "description": "Display a translated portable link to the full Journal.",
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json", "$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3, "apiVersion": 3,
"name": "chrnx/journal-stream", "name": "chrnx/journal-stream",
"version": "0.4.3", "version": "0.4.4",
"title": "Journal Stream", "title": "Journal Stream",
"category": "theme", "category": "theme",
"description": "The filterable chronological journal.", "description": "The filterable chronological journal.",
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json", "$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3, "apiVersion": 3,
"name": "chrnx/latest-podcast", "name": "chrnx/latest-podcast",
"version": "0.4.3", "version": "0.4.4",
"title": "Latest Podcast", "title": "Latest Podcast",
"category": "theme", "category": "theme",
"description": "A linked card for the latest podcast episode.", "description": "A linked card for the latest podcast episode.",
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json", "$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3, "apiVersion": 3,
"name": "chrnx/mobile-menu-toggle", "name": "chrnx/mobile-menu-toggle",
"version": "0.4.3", "version": "0.4.4",
"title": "CHRNX Mobile Menu Toggle", "title": "CHRNX Mobile Menu Toggle",
"category": "theme", "category": "theme",
"description": "Progressively reveal the primary navigation on small screens.", "description": "Progressively reveal the primary navigation on small screens.",
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json", "$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3, "apiVersion": 3,
"name": "chrnx/podcast-meta", "name": "chrnx/podcast-meta",
"version": "0.4.3", "version": "0.4.4",
"title": "Podcast Metadata", "title": "Podcast Metadata",
"category": "theme", "category": "theme",
"description": "Safe episode details for the current post.", "description": "Safe episode details for the current post.",
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json", "$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3, "apiVersion": 3,
"name": "chrnx/reading-time", "name": "chrnx/reading-time",
"version": "0.4.3", "version": "0.4.4",
"title": "Reading Time", "title": "Reading Time",
"category": "theme", "category": "theme",
"description": "Display a localized estimate based on the current post content.", "description": "Display a localized estimate based on the current post content.",
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json", "$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3, "apiVersion": 3,
"name": "chrnx/related-posts", "name": "chrnx/related-posts",
"version": "0.4.3", "version": "0.4.4",
"title": "Related Posts", "title": "Related Posts",
"category": "theme", "category": "theme",
"description": "Related stories selected by topic, tags, and recency.", "description": "Related stories selected by topic, tags, and recency.",
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json", "$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3, "apiVersion": 3,
"name": "chrnx/release-detail", "name": "chrnx/release-detail",
"version": "0.4.3", "version": "0.4.4",
"title": "Release Detail", "title": "Release Detail",
"category": "theme", "category": "theme",
"description": "Album cover, listening links, and the ordered tracklist.", "description": "Album cover, listening links, and the ordered tracklist.",
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json", "$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3, "apiVersion": 3,
"name": "chrnx/release-list", "name": "chrnx/release-list",
"version": "0.4.3", "version": "0.4.4",
"title": "Release List", "title": "Release List",
"category": "theme", "category": "theme",
"description": "The No Names releases, each linking to its album page.", "description": "The No Names releases, each linking to its album page.",
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json", "$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3, "apiVersion": 3,
"name": "chrnx/selected-work", "name": "chrnx/selected-work",
"version": "0.4.3", "version": "0.4.4",
"title": "Selected Work", "title": "Selected Work",
"category": "theme", "category": "theme",
"description": "Hand-picked projects first, then the most recent ones.", "description": "Hand-picked projects first, then the most recent ones.",
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json", "$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3, "apiVersion": 3,
"name": "chrnx/show-links", "name": "chrnx/show-links",
"version": "0.4.3", "version": "0.4.4",
"title": "Show Links", "title": "Show Links",
"category": "theme", "category": "theme",
"description": "Where a podcast show can be listened to, rendered only when a URL exists.", "description": "Where a podcast show can be listened to, rendered only when a URL exists.",
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json", "$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3, "apiVersion": 3,
"name": "chrnx/site-brand", "name": "chrnx/site-brand",
"version": "0.4.3", "version": "0.4.4",
"title": "CHRNX Site Brand", "title": "CHRNX Site Brand",
"category": "theme", "category": "theme",
"description": "Display the local CHRNX wordmark linked to the site home.", "description": "Display the local CHRNX wordmark linked to the site home.",
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json", "$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3, "apiVersion": 3,
"name": "chrnx/subscribe-cta", "name": "chrnx/subscribe-cta",
"version": "0.4.3", "version": "0.4.4",
"title": "Subscribe CTA", "title": "Subscribe CTA",
"category": "theme", "category": "theme",
"description": "A call to action linked to the configured subscribe page.", "description": "A call to action linked to the configured subscribe page.",
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json", "$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3, "apiVersion": 3,
"name": "chrnx/subscribe-form", "name": "chrnx/subscribe-form",
"version": "0.4.3", "version": "0.4.4",
"title": "Subscribe Form", "title": "Subscribe Form",
"category": "theme", "category": "theme",
"description": "The email subscription form, rendered only when a provider endpoint is configured.", "description": "The email subscription form, rendered only when a provider endpoint is configured.",
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json", "$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3, "apiVersion": 3,
"name": "chrnx/theme-toggle", "name": "chrnx/theme-toggle",
"version": "0.4.3", "version": "0.4.4",
"title": "Theme Toggle", "title": "Theme Toggle",
"category": "theme", "category": "theme",
"description": "Choose a light, dark, or system color theme.", "description": "Choose a light, dark, or system color theme.",
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json", "$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3, "apiVersion": 3,
"name": "chrnx/topic-hero", "name": "chrnx/topic-hero",
"version": "0.4.3", "version": "0.4.4",
"title": "Topic Hero", "title": "Topic Hero",
"category": "theme", "category": "theme",
"description": "A fixed-art hero for an editorial topic.", "description": "A fixed-art hero for an editorial topic.",
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json", "$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3, "apiVersion": 3,
"name": "chrnx/track-meta", "name": "chrnx/track-meta",
"version": "0.4.3", "version": "0.4.4",
"title": "Track Meta", "title": "Track Meta",
"category": "theme", "category": "theme",
"description": "Player, listening links, and album for one song.", "description": "Player, listening links, and album for one song.",
+1 -1
View File
@@ -1,5 +1,5 @@
<?php <?php
define( 'CHRNX_VERSION', '0.4.3' ); define( 'CHRNX_VERSION', '0.4.4' );
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
foreach ( array( 'setup', 'assets', 'taxonomies', 'editor', 'podcast-meta', 'project-meta', 'release-meta', 'show-meta', 'track-meta', 'settings', 'queries', 'media', 'blocks', 'theme-preference' ) as $module ) { foreach ( array( 'setup', 'assets', 'taxonomies', 'editor', 'podcast-meta', 'project-meta', 'release-meta', 'show-meta', 'track-meta', 'settings', 'queries', 'media', 'blocks', 'theme-preference' ) as $module ) {
+56
View File
@@ -32,6 +32,62 @@ function chrnx_setup() {
add_action( 'after_setup_theme', 'chrnx_setup' ); add_action( 'after_setup_theme', 'chrnx_setup' );
add_filter( 'comments_open', '__return_false' ); 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. * Print Open Graph and Twitter card tags only when nothing else does.
* *
+1 -1
View File
@@ -3,6 +3,6 @@ Theme Name: CHRNX
Description: A native block theme for chrnx.dev. Description: A native block theme for chrnx.dev.
Requires at least: 6.9 Requires at least: 6.9
Requires PHP: 8.1 Requires PHP: 8.1
Version: 0.4.3 Version: 0.4.4
Text Domain: chrnx Text Domain: chrnx
*/ */
+77
View File
@@ -37,6 +37,83 @@ class ThemeSetupTest extends WP_UnitTestCase {
$this->assertContains( 'assets/css/components.css', $editor_styles ); $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. * Ensure the local base stylesheet is enqueued with the theme version.
*/ */
+1 -1
View File
@@ -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['@wordpress/scripts'], '34.0.0');
assert.equal(pkg.devDependencies['@playwright/test'], '1.62.1'); assert.equal(pkg.devDependencies['@playwright/test'], '1.62.1');
assert.equal(pkg.devDependencies.lighthouse, '13.4.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.phpVersion, '8.3');
assert.equal(env.autoPort, false); assert.equal(env.autoPort, false);
assert.equal(env.port, 8888); assert.equal(env.port, 8888);