Compare commits

...
4 Commits
Author SHA1 Message Date
chrnxandClaude Opus 5 6dc4de6b8e fix: stop the text palette slug from hijacking every custom colour
theme.json shipped a palette entry with the slug "text", so WordPress
generated `.has-text-color { color: var(--wp--preset--color--text)
!important }`. The block editor puts that same class on any block given a
custom text colour, so the rule overrode every one of them site-wide with
the dark-theme foreground, unreadable in either theme. An !important
declaration beats an inline style, which is why the colour set on the
block never had a chance.

Rename the slug to "foreground". No published content used the class, for
the obvious reason that it never worked, so nothing has to be migrated.
A smoke test now rejects any palette slug that shadows an editor utility
class.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-14 10:21:23 -05:00
chrnxandClaude Opus 5 13a8b0425f fix: keep the block title tag and drop Rank Math's relocated copy
Rank Math moves _wp_render_title_tag off wp_head into its own
rank_math/head block, but it does not know about the block-theme renderer
that replaced it, so both rendered. The previous release removed the
block renderer and kept the relocated one, which fixed the duplicate but
left the page depending on a plugin that may print nothing at all: Rank
Math skips its entire frontend until its setup wizard completes, and in
that state the page had no <title> and no social tags.

Remove the relocated copy instead. Both carry the same text, since Rank
Math supplies it through pre_get_document_title, and the block renderer
survives when the plugin is absent or silent. The removal needs no guard:
with no Rank Math, rank_math/head holds no callbacks.

For the same reason chrnx_has_seo_plugin() now asks whether an SEO plugin
actually printed its head, not whether one happens to be installed.

Verified against a real Rank Math install in all three states: emitting,
installed but silent, and absent. One title every time, never zero.

The subscribe call to action now also runs on Pages and archives, so the
Journal and the topic archives can convert, and it skips the Subscribe
page itself rather than linking there from there.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-14 09:51:03 -05:00
chrnxandClaude Opus 5 e394b88ee6 fix: remove the block theme's title tag, not the classic one
The duplicate <title> survived the last release. Block themes swap
_wp_render_title_tag for _block_template_render_title_tag, so removing
the classic callback matched nothing and both titles kept rendering.

locate_block_template() registers the replacement during template_include,
after `wp` and template_redirect, so wp_head at priority 0 is the earliest
point where it can be removed before it runs.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-14 08:55:31 -05:00
chrnxandClaude Opus 5 f9191a18bc fix: make topics reachable and stop the head fighting itself
Every topic archive rendered its character art gate against the design
master, which package-theme.sh deliberately strips, so production showed
an empty stage on all eight of them. Gate on the derivative the markup
actually loads instead.

Nothing linked to a topic archive: the only filter was a select inside a
form, invisible to crawlers and to anyone not looking for it. The stream
now also lists the non-empty topics as links, marking the current one.
Empty topics stay out, because a dead archive is worse than no link.

Rank Math already owns the document head, so the theme's own og: tags
were a second, conflicting set and core's title tag was a literal
duplicate. Both now yield when an SEO plugin is active.

Category archives listed the same posts as their topic at a second
indexable URL. They now redirect to the same-slug topic, or the Journal.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-14 08:43:16 -05:00
36 changed files with 469 additions and 188 deletions

No files matched your search

+1 -1
View File
@@ -17,7 +17,7 @@ html {
body { body {
margin: 0; margin: 0;
background: var(--wp--preset--color--night); background: var(--wp--preset--color--night);
color: var(--wp--preset--color--text); color: var(--wp--preset--color--foreground);
overflow-wrap: break-word; overflow-wrap: break-word;
} }
+30
View File
@@ -423,6 +423,36 @@ footer a {
--chrnx-card-accent: #d36b3f; --chrnx-card-accent: #d36b3f;
} }
.chrnx-journal-stream__topics {
margin-block-start: 1.5rem;
}
.chrnx-journal-stream__topic {
display: inline-block;
padding: 0.4rem 0.9rem;
border: 1px solid var(--chrnx-line);
border-radius: 999px;
color: var(--chrnx-muted);
font-family: var(--wp--preset--font-family--metadata);
font-size: 0.75rem;
font-weight: 700;
letter-spacing: 0.12em;
text-decoration: none;
text-transform: uppercase;
}
.chrnx-journal-stream__topic:hover,
.chrnx-journal-stream__topic:focus-visible {
border-color: var(--chrnx-green);
color: var(--chrnx-green);
}
.chrnx-journal-stream__topic[aria-current="page"] {
border-color: var(--chrnx-green);
background: var(--chrnx-green);
color: var(--chrnx-bg);
}
.chrnx-journal-stream__filters { .chrnx-journal-stream__filters {
align-items: end; align-items: end;
margin-block: 2rem; margin-block: 2rem;
+2 -2
View File
@@ -126,7 +126,7 @@ html[data-theme="light"] header.wp-block-template-part {
.chrnx-theme-control > [data-chrnx-theme-button]:hover, .chrnx-theme-control > [data-chrnx-theme-button]:hover,
.chrnx-theme-control > [data-chrnx-theme-button][aria-expanded="true"] { .chrnx-theme-control > [data-chrnx-theme-button][aria-expanded="true"] {
background: color-mix(in srgb, var(--wp--preset--color--green) 24%, transparent); background: color-mix(in srgb, var(--wp--preset--color--green) 24%, transparent);
color: var(--wp--preset--color--text); color: var(--wp--preset--color--foreground);
opacity: 1; opacity: 1;
} }
@@ -260,7 +260,7 @@ html[data-theme="light"] .chrnx-theme-control > [data-chrnx-theme-button][aria-e
/* Quiet chip, full-contrast label: accent-on-accent fails WCAG AA. */ /* Quiet chip, full-contrast label: accent-on-accent fails WCAG AA. */
.chrnx-theme-toggle [data-chrnx-theme-value][aria-pressed="true"] { .chrnx-theme-toggle [data-chrnx-theme-value][aria-pressed="true"] {
background: color-mix(in srgb, var(--wp--preset--color--green) 24%, transparent); background: color-mix(in srgb, var(--wp--preset--color--green) 24%, transparent);
color: var(--wp--preset--color--text); color: var(--wp--preset--color--foreground);
opacity: 1; opacity: 1;
} }
+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.3.0", "version": "0.4.3",
"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.3.0", "version": "0.4.3",
"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.3.0", "version": "0.4.3",
"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.3.0", "version": "0.4.3",
"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.3.0", "version": "0.4.3",
"title": "Journal Stream", "title": "Journal Stream",
"category": "theme", "category": "theme",
"description": "The filterable chronological journal.", "description": "The filterable chronological journal.",
+31
View File
@@ -29,6 +29,37 @@ $chrnx_title = null !== $chrnx_pinned_term ? $chrnx_pinned_term->name : __( 'Jou
?> ?>
<section <?php echo get_block_wrapper_attributes( array( 'class' => 'chrnx-journal-stream' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> aria-labelledby="<?php echo esc_attr( $chrnx_title_id ); ?>"> <section <?php echo get_block_wrapper_attributes( array( 'class' => 'chrnx-journal-stream' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> aria-labelledby="<?php echo esc_attr( $chrnx_title_id ); ?>">
<h<?php echo esc_attr( $chrnx_heading ); ?> id="<?php echo esc_attr( $chrnx_title_id ); ?>"><?php echo esc_html( $chrnx_title ); ?></h<?php echo esc_attr( $chrnx_heading ); ?>> <h<?php echo esc_attr( $chrnx_heading ); ?> id="<?php echo esc_attr( $chrnx_title_id ); ?>"><?php echo esc_html( $chrnx_title ); ?></h<?php echo esc_attr( $chrnx_heading ); ?>>
<?php
/*
* The select below is invisible to crawlers and to anyone not hunting for it.
* These are the same filters as real links, so topics have an entry point.
* Empty topics stay hidden: a dead archive is worse than no link.
*/
$chrnx_topic_terms = get_terms(
array(
'taxonomy' => 'chrnx_topic',
'hide_empty' => true,
)
);
$chrnx_topic_terms = is_wp_error( $chrnx_topic_terms ) ? array() : $chrnx_topic_terms;
?>
<?php if ( count( $chrnx_topic_terms ) > 1 ) : ?>
<nav class="chrnx-journal-stream__topics" aria-label="<?php echo esc_attr__( 'Topics', 'chrnx' ); ?>">
<ul>
<li>
<a class="chrnx-journal-stream__topic" href="<?php echo esc_url( chrnx_get_full_journal_url() ); ?>"<?php echo '' === $chrnx_topic ? ' aria-current="page"' : ''; ?>><?php echo esc_html__( 'All', 'chrnx' ); ?></a>
</li>
<?php foreach ( $chrnx_topic_terms as $chrnx_term ) : ?>
<?php $chrnx_term_link = get_term_link( $chrnx_term ); ?>
<?php if ( ! is_wp_error( $chrnx_term_link ) ) : ?>
<li>
<a class="chrnx-journal-stream__topic" href="<?php echo esc_url( $chrnx_term_link ); ?>"<?php echo $chrnx_topic === $chrnx_term->slug ? ' aria-current="page"' : ''; ?>><?php echo esc_html( $chrnx_term->name ); ?></a>
</li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
</nav>
<?php endif; ?>
<form class="chrnx-journal-stream__filters" method="get" action="<?php echo esc_url( $chrnx_form_url ); ?>"> <form class="chrnx-journal-stream__filters" method="get" action="<?php echo esc_url( $chrnx_form_url ); ?>">
<?php if ( isset( $chrnx_fixed['taxonomy'] ) && 'chrnx_topic' === $chrnx_fixed['taxonomy'] ) : ?> <?php if ( isset( $chrnx_fixed['taxonomy'] ) && 'chrnx_topic' === $chrnx_fixed['taxonomy'] ) : ?>
<p class="chrnx-journal-stream__fixed-filter"><span><?php echo esc_html__( 'Topic', 'chrnx' ); ?></span> <strong><?php echo esc_html( $chrnx_fixed['label'] ); ?></strong></p> <p class="chrnx-journal-stream__fixed-filter"><span><?php echo esc_html__( 'Topic', 'chrnx' ); ?></span> <strong><?php echo esc_html( $chrnx_fixed['label'] ); ?></strong></p>
+9
View File
@@ -1,3 +1,12 @@
.chrnx-journal-stream__topics ul {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
list-style: none;
padding: 0;
margin: 0;
}
.chrnx-journal-stream__filters { .chrnx-journal-stream__filters {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
+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.3.0", "version": "0.4.3",
"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.3.0", "version": "0.4.3",
"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.3.0", "version": "0.4.3",
"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.3.0", "version": "0.4.3",
"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.3.0", "version": "0.4.3",
"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 @@
--chrnx-related-gap: var(--wp--preset--spacing--40, 1.5rem); --chrnx-related-gap: var(--wp--preset--spacing--40, 1.5rem);
--chrnx-related-control-background: var(--wp--preset--color--panel); --chrnx-related-control-background: var(--wp--preset--color--panel);
--chrnx-related-control-border: var(--wp--preset--color--muted); --chrnx-related-control-border: var(--wp--preset--color--muted);
--chrnx-related-control-text: var(--wp--preset--color--text); --chrnx-related-control-text: var(--wp--preset--color--foreground);
--chrnx-related-focus-ring: var(--wp--preset--color--green); --chrnx-related-focus-ring: var(--wp--preset--color--green);
max-width: 100%; max-width: 100%;
+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.3.0", "version": "0.4.3",
"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.3.0", "version": "0.4.3",
"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.3.0", "version": "0.4.3",
"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.3.0", "version": "0.4.3",
"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.3.0", "version": "0.4.3",
"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.3.0", "version": "0.4.3",
"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.",
+5
View File
@@ -9,6 +9,11 @@ $chrnx_url = chrnx_get_subscribe_url();
if ( '' === $chrnx_url ) { if ( '' === $chrnx_url ) {
return; return;
} }
// page.html renders every Page, Subscribe included, and a call to action
// pointing at the page you are already reading is just noise.
if ( is_page( absint( get_option( 'chrnx_subscribe_page_id', 0 ) ) ) ) {
return;
}
$chrnx_heading = chrnx_get_heading_level( $attributes['headingLevel'] ?? 2, 2 ); $chrnx_heading = chrnx_get_heading_level( $attributes['headingLevel'] ?? 2, 2 );
?> ?>
<section <?php echo get_block_wrapper_attributes( array( 'class' => 'chrnx-subscribe-cta' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>> <section <?php echo get_block_wrapper_attributes( array( 'class' => 'chrnx-subscribe-cta' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
+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.3.0", "version": "0.4.3",
"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.3.0", "version": "0.4.3",
"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.3.0", "version": "0.4.3",
"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.",
+8 -1
View File
@@ -22,7 +22,14 @@ $chrnx_art_topic = 'chrnx_show' === $chrnx_taxonomy ? 'podcasts' : $chrnx_topic;
$chrnx_asset = chrnx_get_topic_art_asset( $chrnx_art_topic ); $chrnx_asset = chrnx_get_topic_art_asset( $chrnx_art_topic );
$chrnx_size = chrnx_get_topic_art_dimensions( $chrnx_art_topic ); $chrnx_size = chrnx_get_topic_art_dimensions( $chrnx_art_topic );
$chrnx_has_art = '' !== $chrnx_asset && 2 === count( $chrnx_size ); $chrnx_has_art = '' !== $chrnx_asset && 2 === count( $chrnx_size );
$chrnx_has_image = $chrnx_has_art && is_readable( get_theme_file_path( $chrnx_asset ) ); /*
* The packaged theme ships only assets/images/generated, so the design master
* is absent in production and gating on it hid the art on every topic archive.
* Check the derivative the markup actually loads.
*/
$chrnx_has_image = $chrnx_has_art && is_readable(
get_theme_file_path( 'assets/images/generated/' . pathinfo( $chrnx_asset, PATHINFO_FILENAME ) . '-768.webp' )
);
$chrnx_heading = chrnx_get_heading_level( $attributes['headingLevel'] ?? 2, 2 ); $chrnx_heading = chrnx_get_heading_level( $attributes['headingLevel'] ?? 2, 2 );
$chrnx_term = $chrnx_queried instanceof WP_Term && $chrnx_queried->slug === $chrnx_topic ? $chrnx_queried : get_term_by( 'slug', $chrnx_topic, 'chrnx_topic' ); $chrnx_term = $chrnx_queried instanceof WP_Term && $chrnx_queried->slug === $chrnx_topic ? $chrnx_queried : get_term_by( 'slug', $chrnx_topic, 'chrnx_topic' );
$chrnx_label = $chrnx_term instanceof WP_Term ? $chrnx_term->name : ucwords( str_replace( '-', ' ', $chrnx_topic ) ); $chrnx_label = $chrnx_term instanceof WP_Term ? $chrnx_term->name : ucwords( str_replace( '-', ' ', $chrnx_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.3.0", "version": "0.4.3",
"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.3.0' ); define( 'CHRNX_VERSION', '0.4.3' );
// 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 ) {
+40 -2
View File
@@ -33,11 +33,17 @@ add_action( 'after_setup_theme', 'chrnx_setup' );
add_filter( 'comments_open', '__return_false' ); add_filter( 'comments_open', '__return_false' );
/** /**
* Print Open Graph and Twitter card tags for the current request. * Print Open Graph and Twitter card tags only when nothing else does.
* *
* ponytail: hand-rolled because the theme needs four tags, not an SEO plugin. * ponytail: an installed SEO plugin already emits these per post, with the
* right title and image. Two sets of og: tags let crawlers pick the wrong one,
* so the theme yields and only covers the no-plugin case.
*/ */
function chrnx_print_social_meta() { function chrnx_print_social_meta() {
if ( chrnx_has_seo_plugin() ) {
return;
}
if ( is_singular() ) { if ( is_singular() ) {
$title = get_the_title(); $title = get_the_title();
$url = get_permalink(); $url = get_permalink();
@@ -79,3 +85,35 @@ function chrnx_print_social_meta() {
echo '<meta name="twitter:card" content="summary_large_image" />' . "\n"; echo '<meta name="twitter:card" content="summary_large_image" />' . "\n";
} }
add_action( 'wp_head', 'chrnx_print_social_meta' ); add_action( 'wp_head', 'chrnx_print_social_meta' );
/**
* Report whether an SEO plugin already printed the document head.
*
* Deliberately not "is one installed": Rank Math skips its whole frontend
* until its setup wizard completes, so an installed-but-silent plugin used to
* make the theme yield to nobody. rank_math/head fires only when it really
* rendered, and it runs at wp_head priority 1, ahead of the tags below.
*
* @return bool True when an SEO plugin printed its head block.
*/
function chrnx_has_seo_plugin(): bool {
return did_action( 'rank_math/head' ) > 0;
}
/**
* Drop the relocated copy of core's title tag.
*
* Rank Math moves _wp_render_title_tag off wp_head and into its own
* rank_math/head block, but it does not know about the block-theme renderer
* that replaced it, so block themes render two identical <title> elements.
*
* Remove the relocated copy, never the block one. Both carry the same text,
* because Rank Math supplies it through pre_get_document_title, and keeping
* the block renderer means a page still has a title when the plugin is
* absent or silent. No guard is needed: with no Rank Math, rank_math/head
* holds no callbacks and this is a no-op.
*/
function chrnx_remove_duplicate_title_tag() {
remove_action( 'rank_math/head', '_wp_render_title_tag', 1 );
}
add_action( 'wp_head', 'chrnx_remove_duplicate_title_tag', 0 );
+36
View File
@@ -123,6 +123,42 @@ function chrnx_seed_editorial_terms() {
} }
add_action( 'after_switch_theme', 'chrnx_seed_editorial_terms' ); add_action( 'after_switch_theme', 'chrnx_seed_editorial_terms' );
/**
* Retire the legacy category archives.
*
* chrnx_topic is the editorial taxonomy. Category archives listed the same
* posts at a second indexable URL, so both competed for the same queries.
* A same-slug topic keeps that equity; everything else folds into the Journal.
*
* ponytail: matching by slug instead of a hand-kept category-to-topic map.
*/
function chrnx_redirect_legacy_category_archives() {
if ( ! is_category() ) {
return;
}
$category = get_queried_object();
$target = '';
if ( $category instanceof WP_Term ) {
$topic = get_term_by( 'slug', $category->slug, 'chrnx_topic' );
if ( $topic instanceof WP_Term && $topic->count > 0 ) {
$link = get_term_link( $topic );
$target = is_wp_error( $link ) ? '' : $link;
}
}
if ( '' === $target ) {
$target = chrnx_get_full_journal_url();
}
if ( '' === $target ) {
return;
}
wp_safe_redirect( $target, 301 );
exit;
}
add_action( 'template_redirect', 'chrnx_redirect_legacy_category_archives' );
/** /**
* Return the current user's editorial notice transient key. * Return the current user's editorial notice transient key.
* *
+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.3.0 Version: 0.4.3
Text Domain: chrnx Text Domain: chrnx
*/ */
+1
View File
@@ -6,6 +6,7 @@
<!-- wp:term-description /--> <!-- wp:term-description /-->
<!-- wp:chrnx/topic-hero /--> <!-- wp:chrnx/topic-hero /-->
<!-- wp:chrnx/journal-stream /--> <!-- wp:chrnx/journal-stream /-->
<!-- wp:chrnx/subscribe-cta {"className":"is-style-quiet"} /-->
</main> </main>
<!-- /wp:group --> <!-- /wp:group -->
+1
View File
@@ -4,6 +4,7 @@
<main id="chrnx-main" class="wp-block-group chrnx-entry chrnx-entry--page" tabindex="-1"> <main id="chrnx-main" class="wp-block-group chrnx-entry chrnx-entry--page" tabindex="-1">
<!-- wp:post-title {"level":1} /--> <!-- wp:post-title {"level":1} /-->
<!-- wp:post-content {"layout":{"type":"constrained"}} /--> <!-- wp:post-content {"layout":{"type":"constrained"}} /-->
<!-- wp:chrnx/subscribe-cta {"className":"is-style-quiet"} /-->
</main> </main>
<!-- /wp:group --> <!-- /wp:group -->
+17 -1
View File
@@ -112,7 +112,7 @@ test('theme.json exposes the complete dark and warm-light palette with stable se
panel: '#161B22', panel: '#161B22',
violet: '#7C6CF0', violet: '#7C6CF0',
green: '#5FB88A', green: '#5FB88A',
text: '#E6EDF3', foreground: '#E6EDF3',
muted: '#8B949E', muted: '#8B949E',
paper: '#F6F2E9', paper: '#F6F2E9',
surface: '#FFFDF7', surface: '#FFFDF7',
@@ -126,6 +126,22 @@ test('theme.json exposes the complete dark and warm-light palette with stable se
assert.deepEqual(palette, expectedTokens); assert.deepEqual(palette, expectedTokens);
}); });
test('no palette slug collides with a block editor utility class', async () => {
const theme = JSON.parse(await readProjectFile('theme.json'));
/*
* WordPress emits `.has-<slug>-color { color: ... !important }` for every
* palette entry. The editor adds the class `has-text-color` to any block
* carrying a custom text colour, so a slug named "text" produced a rule
* that overrode every custom colour on the site with the preset value.
*/
const reserved = new Set(['text', 'background', 'link']);
const collisions = theme.settings.color.palette
.map(({ slug }) => slug)
.filter((slug) => reserved.has(slug));
assert.deepEqual(collisions, []);
});
test('the local Zen Maru Gothic files and license are present', async () => { test('the local Zen Maru Gothic files and license are present', async () => {
await Promise.all([ await Promise.all([
'assets/fonts/zen-maru-gothic-latin-500.woff2', 'assets/fonts/zen-maru-gothic-latin-500.woff2',
+265 -158
View File
@@ -1,160 +1,267 @@
{ {
"$schema": "https://schemas.wp.org/wp/6.9/theme.json", "$schema": "https://schemas.wp.org/wp/6.9/theme.json",
"version": 3, "version": 3,
"settings": { "settings": {
"appearanceTools": true, "appearanceTools": true,
"color": { "color": {
"defaultPalette": false, "defaultPalette": false,
"palette": [ "palette": [
{ "slug": "night", "color": "#0D1117", "name": "Night" }, {
{ "slug": "panel", "color": "#161B22", "name": "Panel" }, "slug": "night",
{ "slug": "violet", "color": "#7C6CF0", "name": "Violet" }, "color": "#0D1117",
{ "slug": "green", "color": "#5FB88A", "name": "Green" }, "name": "Night"
{ "slug": "text", "color": "#E6EDF3", "name": "Text" }, },
{ "slug": "muted", "color": "#8B949E", "name": "Muted" }, {
{ "slug": "paper", "color": "#F6F2E9", "name": "Paper" }, "slug": "panel",
{ "slug": "surface", "color": "#FFFDF7", "name": "Surface" }, "color": "#161B22",
{ "slug": "ink", "color": "#25221F", "name": "Ink" }, "name": "Panel"
{ "slug": "light-muted", "color": "#625C54", "name": "Light Muted" }, },
{ "slug": "light-violet", "color": "#674CA4", "name": "Light Violet" }, {
{ "slug": "light-green", "color": "#327854", "name": "Light Green" }, "slug": "violet",
{ "slug": "border", "color": "#DED6C7", "name": "Border" } "color": "#7C6CF0",
] "name": "Violet"
}, },
"layout": { {
"contentSize": "720px", "slug": "green",
"wideSize": "1120px" "color": "#5FB88A",
}, "name": "Green"
"spacing": { },
"defaultSpacingSizes": false, {
"spacingSizes": [ "slug": "foreground",
{ "slug": "20", "size": "clamp(0.5rem, 0.4rem + 0.4vw, 0.75rem)", "name": "2XS" }, "color": "#E6EDF3",
{ "slug": "30", "size": "clamp(0.75rem, 0.6rem + 0.6vw, 1rem)", "name": "XS" }, "name": "Text"
{ "slug": "40", "size": "clamp(1rem, 0.8rem + 0.8vw, 1.5rem)", "name": "Small" }, },
{ "slug": "50", "size": "clamp(1.5rem, 1.1rem + 1.2vw, 2.25rem)", "name": "Medium" }, {
{ "slug": "60", "size": "clamp(2.25rem, 1.6rem + 2vw, 3.5rem)", "name": "Large" }, "slug": "muted",
{ "slug": "70", "size": "clamp(3rem, 2rem + 3vw, 5rem)", "name": "XL" } "color": "#8B949E",
], "name": "Muted"
"units": [ "px", "rem", "em", "%", "vw", "vh" ] },
}, {
"typography": { "slug": "paper",
"defaultFontSizes": false, "color": "#F6F2E9",
"fluid": true, "name": "Paper"
"fontFamilies": [ },
{ {
"slug": "body", "slug": "surface",
"name": "System UI", "color": "#FFFDF7",
"fontFamily": "-apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif" "name": "Surface"
}, },
{ {
"slug": "heading", "slug": "ink",
"name": "Zen Maru Gothic", "color": "#25221F",
"fontFamily": "\"Zen Maru Gothic\", sans-serif", "name": "Ink"
"fontFace": [ },
{ {
"fontFamily": "Zen Maru Gothic", "slug": "light-muted",
"fontStyle": "normal", "color": "#625C54",
"fontWeight": "500", "name": "Light Muted"
"fontDisplay": "swap", },
"src": [ "file:./assets/fonts/zen-maru-gothic-latin-500.woff2" ] {
}, "slug": "light-violet",
{ "color": "#674CA4",
"fontFamily": "Zen Maru Gothic", "name": "Light Violet"
"fontStyle": "normal", },
"fontWeight": "700", {
"fontDisplay": "swap", "slug": "light-green",
"src": [ "file:./assets/fonts/zen-maru-gothic-latin-700.woff2" ] "color": "#327854",
} "name": "Light Green"
] },
}, {
{ "slug": "border",
"slug": "metadata", "color": "#DED6C7",
"name": "System Monospace", "name": "Border"
"fontFamily": "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace" }
} ]
], },
"fontSizes": [ "layout": {
{ "slug": "small", "size": "clamp(0.8125rem, 0.78rem + 0.15vw, 0.875rem)", "name": "Small" }, "contentSize": "720px",
{ "slug": "medium", "size": "clamp(1rem, 0.95rem + 0.2vw, 1.125rem)", "name": "Medium" }, "wideSize": "1120px"
{ "slug": "large", "size": "clamp(1.35rem, 1.15rem + 0.8vw, 1.75rem)", "name": "Large" }, },
{ "slug": "x-large", "size": "clamp(1.75rem, 1.35rem + 1.6vw, 2.75rem)", "name": "Extra Large" }, "spacing": {
{ "slug": "display", "size": "clamp(2.5rem, 1.7rem + 3.2vw, 4.75rem)", "name": "Display" } "defaultSpacingSizes": false,
] "spacingSizes": [
} {
}, "slug": "20",
"styles": { "size": "clamp(0.5rem, 0.4rem + 0.4vw, 0.75rem)",
"color": { "name": "2XS"
"background": "var:preset|color|night", },
"text": "var:preset|color|text" {
}, "slug": "30",
"spacing": { "size": "clamp(0.75rem, 0.6rem + 0.6vw, 1rem)",
"blockGap": "var:preset|spacing|50" "name": "XS"
}, },
"typography": { {
"fontFamily": "var:preset|font-family|body", "slug": "40",
"fontSize": "var:preset|font-size|medium", "size": "clamp(1rem, 0.8rem + 0.8vw, 1.5rem)",
"lineHeight": "1.65" "name": "Small"
}, },
"elements": { {
"button": { "slug": "50",
"color": { "size": "clamp(1.5rem, 1.1rem + 1.2vw, 2.25rem)",
"background": "var:preset|color|green", "name": "Medium"
"text": "var:preset|color|night" },
}, {
"typography": { "slug": "60",
"fontWeight": "700" "size": "clamp(2.25rem, 1.6rem + 2vw, 3.5rem)",
} "name": "Large"
}, },
"heading": { {
"color": { "slug": "70",
"text": "var:preset|color|text" "size": "clamp(3rem, 2rem + 3vw, 5rem)",
}, "name": "XL"
"typography": { }
"fontFamily": "var:preset|font-family|heading", ],
"fontWeight": "700", "units": [
"lineHeight": "1.2" "px",
} "rem",
}, "em",
"link": { "%",
"color": { "vw",
"text": "var:preset|color|violet" "vh"
}, ]
"typography": { },
"textDecoration": "underline" "typography": {
} "defaultFontSizes": false,
} "fluid": true,
}, "fontFamilies": [
"blocks": { {
"core/button": { "slug": "body",
"border": { "name": "System UI",
"radius": "0.35rem" "fontFamily": "-apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif"
} },
}, {
"core/post-date": { "slug": "heading",
"color": { "name": "Zen Maru Gothic",
"text": "var:preset|color|muted" "fontFamily": "\"Zen Maru Gothic\", sans-serif",
}, "fontFace": [
"typography": { {
"fontFamily": "var:preset|font-family|metadata", "fontFamily": "Zen Maru Gothic",
"fontSize": "var:preset|font-size|small" "fontStyle": "normal",
} "fontWeight": "500",
}, "fontDisplay": "swap",
"core/post-terms": { "src": [
"color": { "file:./assets/fonts/zen-maru-gothic-latin-500.woff2"
"text": "var:preset|color|muted" ]
}, },
"typography": { {
"fontFamily": "var:preset|font-family|metadata", "fontFamily": "Zen Maru Gothic",
"fontSize": "var:preset|font-size|small" "fontStyle": "normal",
} "fontWeight": "700",
}, "fontDisplay": "swap",
"core/quote": { "src": [
"border": { "file:./assets/fonts/zen-maru-gothic-latin-700.woff2"
"color": "var:preset|color|violet", ]
"style": "solid", }
"width": "0 0 0 3px" ]
} },
} {
} "slug": "metadata",
} "name": "System Monospace",
"fontFamily": "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace"
}
],
"fontSizes": [
{
"slug": "small",
"size": "clamp(0.8125rem, 0.78rem + 0.15vw, 0.875rem)",
"name": "Small"
},
{
"slug": "medium",
"size": "clamp(1rem, 0.95rem + 0.2vw, 1.125rem)",
"name": "Medium"
},
{
"slug": "large",
"size": "clamp(1.35rem, 1.15rem + 0.8vw, 1.75rem)",
"name": "Large"
},
{
"slug": "x-large",
"size": "clamp(1.75rem, 1.35rem + 1.6vw, 2.75rem)",
"name": "Extra Large"
},
{
"slug": "display",
"size": "clamp(2.5rem, 1.7rem + 3.2vw, 4.75rem)",
"name": "Display"
}
]
}
},
"styles": {
"color": {
"background": "var:preset|color|night",
"text": "var:preset|color|foreground"
},
"spacing": {
"blockGap": "var:preset|spacing|50"
},
"typography": {
"fontFamily": "var:preset|font-family|body",
"fontSize": "var:preset|font-size|medium",
"lineHeight": "1.65"
},
"elements": {
"button": {
"color": {
"background": "var:preset|color|green",
"text": "var:preset|color|night"
},
"typography": {
"fontWeight": "700"
}
},
"heading": {
"color": {
"text": "var:preset|color|foreground"
},
"typography": {
"fontFamily": "var:preset|font-family|heading",
"fontWeight": "700",
"lineHeight": "1.2"
}
},
"link": {
"color": {
"text": "var:preset|color|violet"
},
"typography": {
"textDecoration": "underline"
}
}
},
"blocks": {
"core/button": {
"border": {
"radius": "0.35rem"
}
},
"core/post-date": {
"color": {
"text": "var:preset|color|muted"
},
"typography": {
"fontFamily": "var:preset|font-family|metadata",
"fontSize": "var:preset|font-size|small"
}
},
"core/post-terms": {
"color": {
"text": "var:preset|color|muted"
},
"typography": {
"fontFamily": "var:preset|font-family|metadata",
"fontSize": "var:preset|font-size|small"
}
},
"core/quote": {
"border": {
"color": "var:preset|color|violet",
"style": "solid",
"width": "0 0 0 3px"
}
}
}
}
} }