Compare commits

..
50 Commits
Author SHA1 Message Date
chrnx 76917decd0 feat(editorial): widen sections and add local track pages
Unify the editorial canvas across section pages, keep release tracks out of Journal, and give each song a listening surface with audio, metadata, platform links, sharing, and optional featured art. Document and seed the local The No Names fixture without changing production data.
2026-08-27 20:24:39 -05:00
chrnx 135b462bd2 docs: define local music release card redesign 2026-08-27 14:26:52 -05:00
chrnxandClaude Opus 5 5c5f385bc0 Merge branch 'feature/projects-as-entities'
Projects become their own editorial taxonomy, modelled on releases and shows:
term meta for repository, package, site, status and cover; a list block and an
archive header block; archive templates for projects and podcast shows; a
landing pattern; and the retirement of the featured-project picker.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-15 16:25:09 -05:00
chrnxandClaude Opus 5 7b3298070d chore: release 0.4.5
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-15 16:25:09 -05:00
chrnxandClaude Opus 5 a28d4cbec0 test: describe the projects section as it is after the retirement
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-15 16:19:25 -05:00
chrnxandClaude Opus 5 6f418f1a51 fix: fall back to placeholder art when a cover attachment is gone
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-15 15:34:37 -05:00
chrnxandClaude Opus 5 77dc2ee33b refactor: drop the featured-project picker in favour of the project list
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-15 14:58:19 -05:00
chrnxandClaude Opus 5 7c0eb51dcc docs: the version bump is what makes a new pattern register
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-15 14:53:38 -05:00
chrnxandClaude Opus 5 1c076ffe2f feat: give projects a landing of their own
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-15 14:52:14 -05:00
chrnxandClaude Opus 5 2e43e89795 test: guard taxonomy archive templates' key blocks by content
Only the generic structural loop test covered
taxonomy-chrnx_{project,show,release}.html; nothing asserted their
block content, so the journal-stream regression fixed last round
would have gone uncaught if it recurred. Add content tests for the
project and show templates mirroring the existing archive/search idiom.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-15 14:42:26 -05:00
chrnxandClaude Opus 5 d0b928eba4 docs: name the real retirement surface, including four live assertions
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-15 14:40:16 -05:00
chrnxandClaude Opus 5 0e6a40223e fix: restore episode listing on show archives
taxonomy-chrnx_show.html replaced the generic archive fallback (which
listed episodes via journal-stream) with show-links alone, which
renders nothing for shows without platform-link meta. Add
journal-stream and subscribe-cta back so show archives keep listing
their episodes.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-15 14:38:42 -05:00
chrnxandClaude Opus 5 c2f6ba7752 docs: a dedicated template must not render less than the fallback it replaces
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-15 14:37:24 -05:00
chrnxandClaude Opus 5 847f399886 fix: correct hardcoded generated-image counts after Task 3 regression
Task 3 raised assets/images/generated/ from 76 to 81 files and updated
build-responsive-images.sh's count guard, but missed four other
hardcoded 76/62/14 references in the smoke suite and README.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-15 14:33:32 -05:00
chrnxandClaude Opus 5 9860e69728 feat: give project and show archives their own templates
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-15 14:30:09 -05:00
chrnxandClaude Opus 5 1fda796812 docs: task 7 must style the detail block too, not only the card
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-15 14:25:33 -05:00
chrnxandClaude Opus 5 1e9e5cb07d fix: stop accepting chrnx_project as a journal query param
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-15 14:25:04 -05:00
chrnxandClaude Opus 5 7b69f2e519 docs: keep projects out of the journal request-parameter list
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-15 14:24:44 -05:00
chrnxandClaude Opus 5 aea2c6754b feat: give each project its own page header and post stream
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-15 14:19:58 -05:00
chrnxandClaude Opus 5 51532118bc docs: drop an attribute the project detail render never reads
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-15 14:17:55 -05:00
chrnxandClaude Opus 5 77b7e8f658 test: cover project link rendering in project-list block
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-15 14:16:49 -05:00
chrnxandClaude Opus 5 cf3d4e0729 docs: a project archive must filter the journal, not clone a tracklist
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-15 14:15:20 -05:00
chrnxandClaude Opus 5 54e3e8ccc0 feat: list every project with its status and links
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-15 14:12:38 -05:00
chrnxandClaude Opus 5 873842b2a0 feat: add shared placeholder art for projects without a cover
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-15 14:08:52 -05:00
chrnxandClaude Opus 5 69c57ea73c docs: block directories need explicit registration, not just files
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-15 14:07:58 -05:00
chrnxandClaude Opus 5 6fc35bafd8 docs: widen task 8 to the full retired-feature surface
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-15 14:06:05 -05:00
chrnxandClaude Opus 5 062c3951fa feat: give projects a repository, package and status
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-15 14:04:03 -05:00
chrnxandClaude Opus 5 7895e4e927 docs: correct the project link markup call and resolve two open questions
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-15 14:01:43 -05:00
chrnxandClaude Opus 5 036f9eeb3c feat: model projects as their own editorial taxonomy
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-15 13:59:37 -05:00
chrnxandClaude Opus 5 5e1fcf0315 docs: design and plan projects as first-class entities
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-15 13:55:37 -05:00
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
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
chrnxandClaude Opus 5 8a47b30316 chore: release 0.3.0
The show links feature shipped without a version bump, so a reinstall
would have served the new block's assets from cache under the old
version.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-14 07:41:59 -05:00
chrnxandClaude Opus 5 49047f1337 feat: link a podcast show to where it is heard
Releases already had platform links; shows had none, so the Podcasts
page could not point at Spotify or Apple. chrnx_show terms take a
Spotify, Apple Podcasts and RSS URL now, rendered above the latest
episode and only when a URL exists.

The platform helper takes its definitions as an argument rather than
always reading the release set: a podcast lives on Apple Podcasts, not
Apple Music, and labelling it wrong would send people to the wrong
service.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-13 20:21:01 -05:00
chrnxandClaude Opus 5 cb491adae6 test: cover the new content models and stop duplicate terms
Seeding guarded with term_exists(), which reads a cache that is not
always warm during activation and let a second activation insert
gaming-2, literature-2 and silicon-ranch-2. It asks the taxonomy
directly now, by slug and by name.

Fixtures gain projects and tracks, and the suites follow the assets to
their generated derivatives. Also widens the Site Editor poll, which
threw instead of retrying while the editor was still booting.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-13 19:42:07 -05:00
chrnxandClaude Opus 5 df117e67bb fix: read navigation from WordPress menus
The header and footer had five URLs hardcoded from the local fixtures.
On a site whose pages are named differently, that is five 404s in the
navigation, which is exactly what happened on chrnx.dev.

Both now read an assigned menu and fall back to the built-in pages when
no menu is set or the assigned one is empty.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-13 19:42:07 -05:00
chrnxandClaude Opus 5 6c7ed22970 fix: version block assets so browsers pick up changes
Block viewScript and style URLs are versioned from block.json, not
CHRNX_VERSION, so they kept serving cached JavaScript after the theme
version moved. The theme toggle looked broken because the browser was
still running the script that looked for radio inputs.

All block.json versions now track CHRNX_VERSION, and a smoke test fails
if any of them drift, so this cannot come back silently.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-13 19:42:06 -05:00
chrnxandClaude Opus 5 842c8a9b37 build: package the theme as an installable zip
An allowlist so a new dev file is excluded by default, a version check
against style.css, and a refusal to ship tests, scripts or vendor.

The first package was 34MB because every img fallback pointed at the
design master: a browser without AVIF or WebP downloaded 3.4MB per
image. That was a live cost, not just a packaging one. Fallbacks point
at the generated WebP now and masters stay out of the zip, which is 3MB.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-13 19:41:48 -05:00
chrnxandClaude Opus 5 f859780eaa feat: add atmosphere backdrops and shipped placeholders
About and Projects had a figure floating on a CSS gradient while Music
and Podcasts had a whole world behind theirs. They get their own
landscape backdrop, which is what made the four read as one series.

Adds placeholder art for a release without a cover and a post without a
featured image, composited over the per-topic accent so a grid of
missing images still varies. Tracks borrow their album cover first.

The generated inventory grows to 76 files. Placeholders encode at lower
quality because they sit at half opacity behind text, which kept the
payload inside its budget instead of raising it again.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-13 19:41:48 -05:00
chrnxandClaude Opus 5 d1ad17f4be feat: add a provider-agnostic subscribe form
Reading settings take an HTTPS endpoint and the email field name, so
the form posts straight to Buttondown, Mailchimp, MailerLite or
anything else without the theme picking one. Without an endpoint the
block renders nothing rather than a form that goes nowhere.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-13 19:41:36 -05:00
chrnxandClaude Opus 5 20c47c927a feat: give releases and tracks their own pages
Albums were three hardcoded cards. An album is a chrnx_release term
now, with cover, status and listening links; its archive is the album
page with an ordered tracklist. A song is a post carrying lyrics and
notes, its track number, and the audio.

The player is a native audio element, no library and no JavaScript.
Platform icons render only when a URL exists, so nothing points at a
service the release is not on yet.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-13 19:41:36 -05:00
chrnxandClaude Opus 5 a142ece51d feat: rebuild the header controls as icon buttons
The theme switch was three labelled radios that wrapped the header onto
a second line with long translations. It is three SVG buttons now, with
search and menu sharing the same language: no resting outline, a filled
chip for the active choice.

Radios gave arrow-key roving for free, so the group reimplements it
rather than losing it. The first chip colour put accent on accent and
failed WCAG AA; the label carries full contrast instead. Mobile targets
sit at 45px because a floor of exactly 44 rounds to 43.99997 in Firefox.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-13 19:41:24 -05:00
chrnxandClaude Opus 5 f55d9d9b45 feat: model projects as posts with a picked Selected work
Projects were hardcoded h3 elements in a pattern: no URL, no feed, no
search, uneditable without touching PHP. They follow the podcast model
now, a chrnx_topic term plus posts.

Adds a chrnx_project_featured flag with an editor toggle so the stage
lists chosen projects first and fills with the most recent. Sticky was
already spoken for by the home featured stories, so the choice needed
its own signal. journal-stream gains a pinned topic attribute, reusing
the archive filter, pagination and empty state it already had.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-13 19:41:24 -05:00
chrnxandClaude Opus 5 a3ba692669 fix: correct entry layout, light mode and editor parity
The single/page/404 templates set contentSize to 70ch, which resolves
against each child's own font size: the display-size h1 asked for
~2660px and broke full bleed while the body stayed narrow. They now
inherit the 720px from theme.json.

Also drops the About facets that duplicated the portrait, adds the
missing prefers-color-scheme branch for the character stage copy
surface (dark text on a dark panel in System light), loads
components.css in the editor, and replaces the unstyled index
fallback with the journal stream.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-13 19:41:09 -05:00
147 changed files with 5756 additions and 546 deletions

No files matched your search

+1
View File
@@ -3,6 +3,7 @@
node_modules/
vendor/
.phpunit.result.cache
.pytest_cache/
dist/
.wp-env.override.json
test-results/
+1 -1
View File
@@ -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,
+21 -6
View File
@@ -66,6 +66,17 @@ discard the pre-fixture snapshot. Run `restore` explicitly to reinstate the
captured option values and owned Subscribe status byte-for-byte and remove the
snapshot. Fixture pages/posts remain local and reusable.
For the local The No Names Music review, mount the source tree from
`/Users/chrnx/projects/suno` and load the four releases, covers, lyrics, and
local-only placeholder platform URLs:
```sh
./scripts/seed-the-no-names-local.sh
```
The placeholder Suno, Spotify, and Apple Music links are intentionally fake and
must be removed or replaced before any production migration.
Rebuild the responsive portrait derivatives on macOS with `sips`, `cwebp`, and
`avifenc`:
@@ -83,13 +94,14 @@ responsive_output=$(mktemp -d "${TMPDIR:-/tmp}/chrnx-responsive.XXXXXX")
The rebuild rejects symlinks, nested paths, nonexistent paths, and destinations
outside the canonical system temporary directory. The automated smoke test
byte-compares all 52 generated files: 42 binary derivatives and 10 manifests.
The inventory has nine portrait families at 384 px and 768 px, plus the Podcast
background family at 384 px, 768 px, and 1536 px. Every 384/768 derivative is
limited to 160 KiB; each 1536 px Podcast derivative is limited to 260 KiB. The
byte-compares all 81 generated files: 66 binary derivatives and 15 manifests.
The inventory has eleven portrait families at 384 px and 768 px, plus three
landscape background families (Podcast, About, and Projects) at 384 px, 768 px,
and 1536 px. Every 384/768 derivative is
limited to 160 KiB; each 1536 px background derivative is limited to 260 KiB. The
collage, Gaming half-body, and Podcast families are capped at 400 KiB, 340 KiB,
and 620 KiB respectively, while all generated binaries together are capped at
2.75 MiB. The complete inventory, including manifests, must rebuild
3 MiB. The complete inventory, including manifests, must rebuild
byte-identically.
The builder uses transactional publication with rollback: a failed promotion
@@ -106,7 +118,10 @@ isolated from the root environment:
```json
{
"port": 8908,
"testsPort": 8909
"testsPort": 8909,
"mappings": {
"wp-content/suno-source": "/Users/chrnx/projects/suno/bands/the-no-names"
}
}
```
+2 -1
View File
@@ -17,7 +17,8 @@ html {
body {
margin: 0;
background: var(--wp--preset--color--night);
color: var(--wp--preset--color--text);
color: var(--wp--preset--color--foreground);
overflow-wrap: break-word;
}
img,
+769 -142
View File
File diff suppressed because it is too large. Load diff
+84 -40
View File
@@ -101,26 +101,64 @@ html[data-theme="light"] header.wp-block-template-part {
height: auto;
}
.chrnx-mobile-menu-toggle {
/* One icon language in the header: no resting outline, chip on hover/focus. */
.chrnx-mobile-menu-toggle,
.chrnx-header-search button,
.chrnx-theme-control > [data-chrnx-theme-button] {
display: inline-flex;
align-items: center;
justify-content: center;
min-width: 45px;
min-height: 45px;
padding: 0;
border: 1px solid currentcolor;
border: 0;
border-radius: 0.35rem;
background: transparent;
color: inherit;
font-size: 1.4rem;
font: inherit;
cursor: pointer;
opacity: 0.65;
}
.chrnx-mobile-menu-toggle[hidden] {
.chrnx-mobile-menu-toggle:hover,
.chrnx-mobile-menu-toggle[aria-expanded="true"],
.chrnx-header-search button:hover,
.chrnx-theme-control > [data-chrnx-theme-button]:hover,
.chrnx-theme-control > [data-chrnx-theme-button][aria-expanded="true"] {
background: color-mix(in srgb, var(--wp--preset--color--green) 24%, transparent);
color: var(--wp--preset--color--foreground);
opacity: 1;
}
html[data-theme="light"] .chrnx-mobile-menu-toggle:hover,
html[data-theme="light"] .chrnx-mobile-menu-toggle[aria-expanded="true"],
html[data-theme="light"] .chrnx-header-search button:hover,
html[data-theme="light"] .chrnx-theme-control > [data-chrnx-theme-button]:hover,
html[data-theme="light"] .chrnx-theme-control > [data-chrnx-theme-button][aria-expanded="true"] {
background: color-mix(in srgb, var(--wp--preset--color--light-green) 20%, transparent);
color: var(--wp--preset--color--ink);
}
@media (prefers-color-scheme: light) {
:root:not([data-theme]) .chrnx-mobile-menu-toggle:hover,
:root:not([data-theme]) .chrnx-mobile-menu-toggle[aria-expanded="true"],
:root:not([data-theme]) .chrnx-header-search button:hover,
:root:not([data-theme]) .chrnx-theme-control > [data-chrnx-theme-button]:hover,
:root:not([data-theme]) .chrnx-theme-control > [data-chrnx-theme-button][aria-expanded="true"] {
background: color-mix(in srgb, var(--wp--preset--color--light-green) 20%, transparent);
color: var(--wp--preset--color--ink);
}
}
/* The shared rule above sets display, so hidden must win back explicitly. */
.chrnx-mobile-menu-toggle[hidden],
.chrnx-theme-control > [data-chrnx-theme-button][hidden] {
display: none;
}
.chrnx-primary-navigation a,
.chrnx-footer-navigation a,
.chrnx-header-search button,
.chrnx-header-search input {
min-width: 45px;
min-height: 45px;
@@ -155,18 +193,6 @@ html[data-theme="light"] header.wp-block-template-part {
padding-inline: 0.75rem;
}
.chrnx-header-search button {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 0 0.75rem;
border: 1px solid currentcolor;
background: transparent;
color: inherit;
font: inherit;
cursor: pointer;
}
.chrnx-screen-reader-text {
position: absolute;
width: 1px;
@@ -193,7 +219,7 @@ html[data-theme="light"] header.wp-block-template-part {
display: flex;
}
.chrnx-theme-toggle legend {
.chrnx-theme-toggle__legend {
position: absolute;
width: 1px;
height: 1px;
@@ -205,29 +231,50 @@ html[data-theme="light"] header.wp-block-template-part {
border: 0;
}
.chrnx-theme-toggle label {
/* No resting outline: the active choice reads as a filled chip instead. */
.chrnx-theme-toggle [data-chrnx-theme-value] {
display: inline-flex;
align-items: center;
justify-content: center;
min-width: 45px;
min-height: 45px;
padding: 0 0.45rem;
border: 1px solid transparent;
padding: 0;
border: 0;
border-radius: 0.35rem;
background: transparent;
color: inherit;
font: inherit;
cursor: pointer;
opacity: 0.65;
}
.chrnx-theme-toggle label:has(input:checked) {
border-color: currentcolor;
background: var(--wp--preset--color--panel);
.chrnx-theme-toggle [data-chrnx-theme-value] svg {
width: 20px;
height: 20px;
}
html[data-theme="light"] .chrnx-theme-toggle label:has(input:checked) {
background: var(--wp--preset--color--surface);
.chrnx-theme-toggle [data-chrnx-theme-value]:hover {
opacity: 1;
}
.chrnx-theme-toggle input {
accent-color: var(--wp--preset--color--green);
/* Quiet chip, full-contrast label: accent-on-accent fails WCAG AA. */
.chrnx-theme-toggle [data-chrnx-theme-value][aria-pressed="true"] {
background: color-mix(in srgb, var(--wp--preset--color--green) 24%, transparent);
color: var(--wp--preset--color--foreground);
opacity: 1;
}
html[data-theme="light"] .chrnx-theme-toggle [data-chrnx-theme-value][aria-pressed="true"] {
background: color-mix(in srgb, var(--wp--preset--color--light-green) 20%, transparent);
color: var(--wp--preset--color--ink);
}
@media (prefers-color-scheme: light) {
:root:not([data-theme]) .chrnx-theme-toggle [data-chrnx-theme-value][aria-pressed="true"] {
background: color-mix(in srgb, var(--wp--preset--color--light-green) 20%, transparent);
color: var(--wp--preset--color--ink);
}
}
.js .chrnx-header-search[data-expanded="false"] input {
@@ -407,16 +454,8 @@ html[data-theme="light"] footer.wp-block-template-part {
}
.chrnx-theme-control > [data-chrnx-theme-button] {
display: inline-flex;
align-items: center;
justify-content: center;
width: 45px;
height: 45px;
padding: 0;
border: 1px solid currentcolor;
background: transparent;
color: inherit;
cursor: pointer;
}
.chrnx-navigation-enhanced .chrnx-theme-control > [data-chrnx-theme-button] {
@@ -441,20 +480,25 @@ html[data-theme="light"] footer.wp-block-template-part {
min-width: 0;
height: auto;
padding: 0.5rem;
border: 1px solid currentcolor;
border: 1px solid color-mix(in srgb, currentcolor 18%, transparent);
border-radius: 0.35rem;
background: var(--wp--preset--color--panel);
color: inherit;
box-shadow: 0 0.75rem 2rem rgb(0 0 0 / 28%);
}
html[data-theme="light"].chrnx-navigation-enhanced .chrnx-theme-toggle {
background: var(--wp--preset--color--surface);
}
.chrnx-navigation-enhanced .chrnx-theme-toggle label {
/*
* 45px, not 44: a floor set exactly at the WCAG minimum rounds to
* 43.99997px in Firefox and fails the target-size check.
*/
.chrnx-navigation-enhanced .chrnx-theme-toggle [data-chrnx-theme-value] {
flex: 1 1 auto;
min-width: 44px;
min-height: 44px;
min-width: 45px;
min-height: 45px;
white-space: normal;
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

@@ -0,0 +1,5 @@
{
"source": "about-grunge.png",
"formats": [ "avif", "webp" ],
"widths": [ 384, 768, 1536 ]
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

@@ -0,0 +1,5 @@
{
"source": "placeholder-post.png",
"formats": [ "avif", "webp" ],
"widths": [ 384, 768 ]
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

@@ -0,0 +1,5 @@
{
"source": "placeholder-project.png",
"formats": [ "avif", "webp" ],
"widths": [ 384, 768 ]
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

@@ -0,0 +1,5 @@
{
"source": "placeholder-release.png",
"formats": [ "avif", "webp" ],
"widths": [ 384, 768 ]
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

@@ -0,0 +1,5 @@
{
"source": "projects-grunge.png",
"formats": [ "avif", "webp" ],
"widths": [ 384, 768, 1536 ]
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 MiB

+50
View File
@@ -0,0 +1,50 @@
( function () {
'use strict';
function initialize( doc, media ) {
const input = doc.querySelector( '[data-chrnx-release-cover]' );
const button = doc.querySelector( '[data-chrnx-release-cover-pick]' );
const preview = doc.querySelector( '[data-chrnx-release-cover-preview]' );
if ( ! input || ! button || ! preview || typeof media !== 'function' ) {
return false;
}
let frame = null;
button.addEventListener( 'click', function () {
if ( ! frame ) {
frame = media( {
title: button.textContent,
library: { type: 'image' },
multiple: false,
} );
frame.on( 'select', function () {
const attachment = frame.state().get( 'selection' ).first().toJSON();
input.value = attachment.id;
const source = attachment.sizes?.medium?.url || attachment.url;
preview.innerHTML = '';
const image = doc.createElement( 'img' );
image.src = source;
image.alt = attachment.alt || '';
image.style.maxWidth = '240px';
image.style.height = 'auto';
preview.append( image );
} );
}
frame.open();
} );
return true;
}
if ( typeof module !== 'undefined' && module.exports ) {
module.exports = { initialize };
} else if ( typeof document !== 'undefined' ) {
const start = function () {
initialize( document, window.wp && window.wp.media );
};
if ( document.readyState === 'loading' ) {
document.addEventListener( 'DOMContentLoaded', start, { once: true } );
} else {
start();
}
}
} )();
+172
View File
@@ -0,0 +1,172 @@
( function ( factory ) {
if ( typeof module === 'object' && module.exports ) {
module.exports = factory();
} else {
factory().initialize( window.wp );
}
} )( function () {
'use strict';
function platformFields( __ ) {
return [
{ key: 'chrnx_track_url_suno', label: __( 'Suno URL', 'chrnx' ) },
{ key: 'chrnx_track_url_spotify', label: __( 'Spotify URL', 'chrnx' ) },
{ key: 'chrnx_track_url_apple', label: __( 'Apple Music URL', 'chrnx' ) },
];
}
function getTranslator( wp ) {
return wp.i18n && typeof wp.i18n.__ === 'function'
? wp.i18n.__
: function ( text ) {
return text;
};
}
function updateMeta( editPost, currentMeta, key, value ) {
if ( typeof editPost !== 'function' ) {
return;
}
editPost( { meta: { ...( currentMeta || {} ), [ key ]: value } } );
}
function hasRequiredGlobals( wp ) {
return Boolean(
wp &&
wp.components &&
wp.components.TextControl &&
wp.components.Button &&
wp.blockEditor &&
wp.blockEditor.MediaUpload &&
wp.data &&
typeof wp.data.useDispatch === 'function' &&
typeof wp.data.useSelect === 'function' &&
wp.editPost &&
wp.editPost.PluginDocumentSettingPanel &&
wp.element &&
typeof wp.element.createElement === 'function' &&
wp.plugins &&
typeof wp.plugins.registerPlugin === 'function',
);
}
function initialize( wp ) {
if ( ! hasRequiredGlobals( wp ) ) {
return false;
}
const __ = getTranslator( wp );
const el = wp.element.createElement;
function TrackPanel() {
const editorState = wp.data.useSelect( function ( select ) {
if ( typeof select !== 'function' ) {
return null;
}
const currentEditor = select( 'core/editor' );
const core = select( 'core' );
if (
! currentEditor ||
typeof currentEditor.getCurrentPostType !== 'function' ||
typeof currentEditor.getEditedPostAttribute !== 'function' ||
! core ||
typeof core.getEntityRecord !== 'function'
) {
return null;
}
const topicIds = currentEditor.getEditedPostAttribute( 'topic' );
return {
meta: currentEditor.getEditedPostAttribute( 'meta' ) || {},
postType: currentEditor.getCurrentPostType(),
topic:
Array.isArray( topicIds ) && topicIds.length === 1
? core.getEntityRecord( 'taxonomy', 'chrnx_topic', topicIds[ 0 ] )
: null,
};
}, [] );
const editorDispatch = wp.data.useDispatch( 'core/editor' );
if ( ! editorState || editorState.postType !== 'post' || ! editorDispatch?.editPost ) {
return null;
}
if ( ! editorState.topic || editorState.topic.slug !== 'music' ) {
return null;
}
const meta = editorState.meta;
const setMeta = function ( key, value ) {
updateMeta( editorDispatch.editPost, meta, key, value );
};
return el(
wp.editPost.PluginDocumentSettingPanel,
{ name: 'chrnx-track', title: __( 'Track', 'chrnx' ) },
el( wp.components.TextareaControl, {
label: __( 'Track description', 'chrnx' ),
value: meta.chrnx_track_description || '',
onChange( value ) {
setMeta( 'chrnx_track_description', value );
},
} ),
el( wp.components.TextControl, {
label: __( 'Track number', 'chrnx' ),
type: 'number',
min: 0,
value: meta.chrnx_track_number ?? '',
onChange( value ) {
const number = Number.parseInt( value, 10 );
setMeta( 'chrnx_track_number', Number.isInteger( number ) ? Math.max( 0, number ) : 0 );
},
} ),
el( wp.blockEditor.MediaUpload, {
allowedTypes: [ 'audio' ],
value: meta.chrnx_track_audio || 0,
onSelect( attachment ) {
setMeta( 'chrnx_track_audio', attachment?.id ? Number( attachment.id ) : 0 );
},
render( { open } ) {
return el(
wp.components.Button,
{ variant: 'secondary', onClick: open },
meta.chrnx_track_audio
? __( 'Replace audio file', 'chrnx' )
: __( 'Select audio file', 'chrnx' ),
);
},
} ),
meta.chrnx_track_audio
? el(
wp.components.Button,
{
variant: 'link',
isDestructive: true,
onClick() {
setMeta( 'chrnx_track_audio', 0 );
},
},
__( 'Remove audio file', 'chrnx' ),
)
: null,
...platformFields( __ ).map( function ( platform ) {
return el( wp.components.TextControl, {
key: platform.key,
label: platform.label,
type: 'url',
value: meta[ platform.key ] || '',
onChange( value ) {
setMeta( platform.key, value );
},
} );
} ),
);
}
wp.plugins.registerPlugin( 'chrnx-track-meta', { render: TrackPanel } );
return true;
}
return { initialize, updateMeta, platformFields };
} );
+2 -2
View File
@@ -50,7 +50,7 @@
const shell = menuButton && menuButton.parentElement;
const brand = shell && shell.querySelector( '.chrnx-site-brand' );
const navLink = nav && nav.querySelector( 'a[href]' );
const themeRadio = themePanel && themePanel.querySelector( 'input[type="radio"]' );
const themeRadio = themePanel && themePanel.querySelector( '[data-chrnx-theme-value]' );
const required = [
menuButton,
nav,
@@ -107,7 +107,7 @@
let activePanel = null;
const currentThemeRadio = () =>
themePanel.querySelector( 'input[type="radio"]:checked' ) || themeRadio;
themePanel.querySelector( '[data-chrnx-theme-value][aria-pressed="true"]' ) || themeRadio;
const restoreOriginalOrder = () => {
elements.forEach( ( element ) => {
const anchor = anchors.get( element );
+41 -5
View File
@@ -77,7 +77,9 @@
}
}
const controls = [ ...doc.querySelectorAll( '[data-chrnx-theme-toggle] input[type="radio"]' ) ];
const controls = [
...doc.querySelectorAll( '[data-chrnx-theme-toggle] [data-chrnx-theme-value]' ),
];
const groups = [ ...doc.querySelectorAll( '[data-chrnx-theme-toggle]' ) ];
let explicitPreference = readPreference( storage );
let listening = false;
@@ -89,7 +91,8 @@
applyTheme( doc, resolved );
const selected = explicitPreference || 'system';
controls.forEach( ( control ) => {
control.checked = control.value === selected;
const pressed = control.dataset.chrnxThemeValue === selected;
control.setAttribute( 'aria-pressed', String( pressed ) );
} );
groups.forEach( ( group ) => {
const status = group.querySelector( '[data-chrnx-theme-status]' );
@@ -119,19 +122,52 @@
listening = shouldListen;
};
const onChange = ( event ) => {
const value = event.currentTarget.value;
const value = event.currentTarget.dataset.chrnxThemeValue;
explicitPreference = normalizePreference( value );
writePreference( storage, value );
setMediaListening( ! explicitPreference );
update();
};
controls.forEach( ( control ) => control.addEventListener( 'change', onChange ) );
// Buttons do not get the arrow-key roving a native radio group provides,
// so the group reimplements it: move focus and select, like radios did.
const STEPS = { ArrowLeft: -1, ArrowUp: -1, ArrowRight: 1, ArrowDown: 1 };
const onKeydown = ( event ) => {
const step = STEPS[ event.key ];
const toStart = event.key === 'Home';
const toEnd = event.key === 'End';
if ( step === undefined && ! toStart && ! toEnd ) {
return;
}
const group = event.currentTarget.closest( '[data-chrnx-theme-toggle]' );
const siblings = group ? [ ...group.querySelectorAll( '[data-chrnx-theme-value]' ) ] : [];
const index = siblings.indexOf( event.currentTarget );
if ( index < 0 ) {
return;
}
event.preventDefault();
let next = 0;
if ( toEnd ) {
next = siblings.length - 1;
} else if ( ! toStart ) {
next = ( index + step + siblings.length ) % siblings.length;
}
siblings[ next ].focus();
siblings[ next ].click();
};
controls.forEach( ( control ) => {
control.addEventListener( 'click', onChange );
control.addEventListener( 'keydown', onKeydown );
} );
setMediaListening( ! explicitPreference );
update();
cleanupCurrent = () => {
controls.forEach( ( control ) => control.removeEventListener( 'change', onChange ) );
controls.forEach( ( control ) => {
control.removeEventListener( 'click', onChange );
control.removeEventListener( 'keydown', onKeydown );
} );
setMediaListening( false );
cleanupCurrent = null;
};
+32
View File
@@ -0,0 +1,32 @@
( function () {
'use strict';
document.addEventListener( 'click', function ( event ) {
const button = event.target.closest( '[data-chrnx-share]' );
if ( ! button ) {
return;
}
const title = button.dataset.shareTitle || document.title;
const url = button.dataset.shareUrl || window.location.href;
const done = function () {
const original = button.dataset.originalLabel || button.textContent;
button.dataset.originalLabel = original;
button.textContent = 'Enlace copiado';
window.setTimeout( function () {
button.textContent = original;
}, 1800 );
};
if ( navigator.share ) {
navigator.share( { title, url } ).catch( function () {} );
return;
}
if ( navigator.clipboard && navigator.clipboard.writeText ) {
navigator.clipboard
.writeText( url )
.then( done )
.catch( function () {} );
}
} );
} )();
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/featured-stories",
"version": "0.1.0",
"version": "0.4.5",
"title": "Featured Stories",
"category": "theme",
"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",
"apiVersion": 3,
"name": "chrnx/footer-content",
"version": "0.1.0",
"version": "0.4.5",
"title": "CHRNX Footer Content",
"category": "theme",
"description": "Display translated internal footer navigation and site credit.",
+1 -22
View File
@@ -5,28 +5,7 @@
* @package CHRNX
*/
$chrnx_footer_links = array(
array(
'label' => __( 'Journal', 'chrnx' ),
'url' => home_url( '/journal/' ),
),
array(
'label' => __( 'Projects', 'chrnx' ),
'url' => home_url( '/projects/' ),
),
array(
'label' => __( 'Music', 'chrnx' ),
'url' => home_url( '/music/' ),
),
array(
'label' => __( 'Podcasts', 'chrnx' ),
'url' => home_url( '/podcasts/' ),
),
array(
'label' => __( 'About', 'chrnx' ),
'url' => home_url( '/about/' ),
),
);
$chrnx_footer_links = chrnx_get_navigation_links( 'chrnx-footer' );
$chrnx_site_name = get_bloginfo( 'name' );
$chrnx_current_url = chrnx_get_current_navigation_destination();
$chrnx_copyright = sprintf(
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/header-tools",
"version": "0.1.0",
"version": "0.4.5",
"title": "CHRNX Header Tools",
"category": "theme",
"description": "Display translated primary navigation and progressive site search.",
+2 -23
View File
@@ -5,28 +5,7 @@
* @package CHRNX
*/
$chrnx_header_links = array(
array(
'label' => __( 'Journal', 'chrnx' ),
'url' => home_url( '/journal/' ),
),
array(
'label' => __( 'Projects', 'chrnx' ),
'url' => home_url( '/projects/' ),
),
array(
'label' => __( 'Music', 'chrnx' ),
'url' => home_url( '/music/' ),
),
array(
'label' => __( 'Podcasts', 'chrnx' ),
'url' => home_url( '/podcasts/' ),
),
array(
'label' => __( 'About', 'chrnx' ),
'url' => home_url( '/about/' ),
),
);
$chrnx_header_links = chrnx_get_navigation_links( 'chrnx-primary' );
$chrnx_search_label = __( 'Search', 'chrnx' );
$chrnx_search_id = wp_unique_id( 'chrnx-search-' );
$chrnx_search_panel_id = wp_unique_id( 'chrnx-search-panel-' );
@@ -52,7 +31,7 @@ $chrnx_current_url = chrnx_get_current_navigation_destination();
data-label-open="<?php echo esc_attr__( 'Open search', 'chrnx' ); ?>"
data-label-submit="<?php echo esc_attr( $chrnx_search_label ); ?>"
>
<span aria-hidden="true">⌕</span>
<?php echo chrnx_get_icon_markup( 'search' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Helper returns a fixed literal SVG. ?>
<span class="chrnx-screen-reader-text"><?php echo esc_html( $chrnx_search_label ); ?></span>
</button>
</form>
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/journal-link",
"version": "0.1.0",
"version": "0.4.5",
"title": "Journal Link",
"category": "theme",
"description": "Display a translated portable link to the full Journal.",
+3 -2
View File
@@ -2,13 +2,14 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/journal-stream",
"version": "0.1.0",
"version": "0.4.5",
"title": "Journal Stream",
"category": "theme",
"description": "The filterable chronological journal.",
"textdomain": "chrnx",
"attributes": {
"headingLevel": { "type": "integer", "default": 2, "enum": [2, 3, 4, 5, 6] }
"headingLevel": { "type": "integer", "default": 2, "enum": [2, 3, 4, 5, 6] },
"topic": { "type": "string", "default": "" }
},
"supports": { "html": false, "align": ["wide", "full"] },
"style": "file:./style.css",
+42 -3
View File
@@ -5,9 +5,15 @@
* @package CHRNX
*/
// A pinned topic reuses the taxonomy-archive path: same fixed-filter UI, same
// hidden input, same clear link, without needing an archive route.
$chrnx_pinned_slug = chrnx_validate_editorial_term_slug( $attributes['topic'] ?? '', 'chrnx_topic' );
$chrnx_pinned_term = '' !== $chrnx_pinned_slug ? get_term_by( 'slug', $chrnx_pinned_slug, 'chrnx_topic' ) : null;
$chrnx_pinned_term = $chrnx_pinned_term instanceof WP_Term ? $chrnx_pinned_term : null;
// Read-only filters do not change server state; every value is validated by the query service.
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
$chrnx_request = chrnx_get_journal_request_context( is_array( $_GET ) ? $_GET : array() );
$chrnx_request = chrnx_get_journal_request_context( is_array( $_GET ) ? $_GET : array(), $chrnx_pinned_term );
$chrnx_args = chrnx_get_journal_query_args( $chrnx_request );
$chrnx_query = chrnx_run_eligible_query( $chrnx_args );
$chrnx_heading = chrnx_get_heading_level( $attributes['headingLevel'] ?? 2, 2 );
@@ -17,10 +23,43 @@ $chrnx_show = chrnx_validate_editorial_term_slug( $chrnx_request['chrnx_show
$chrnx_search = $chrnx_args['s'] ?? '';
$chrnx_form_url = chrnx_get_journal_base_url();
$chrnx_title_id = wp_unique_id( 'chrnx-journal-title-' );
$chrnx_fixed = chrnx_get_journal_archive_filter();
$chrnx_fixed = chrnx_get_journal_archive_filter( $chrnx_pinned_term );
// A pinned stream is not the Journal; it is that topic's list, so it says so.
$chrnx_title = null !== $chrnx_pinned_term ? $chrnx_pinned_term->name : __( 'Journal', 'chrnx' );
?>
<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__( 'Journal', 'chrnx' ); ?></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 ); ?>">
<?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>
+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 {
display: flex;
flex-wrap: wrap;
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/latest-podcast",
"version": "0.1.0",
"version": "0.4.5",
"title": "Latest Podcast",
"category": "theme",
"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",
"apiVersion": 3,
"name": "chrnx/mobile-menu-toggle",
"version": "0.1.0",
"version": "0.4.5",
"title": "CHRNX Mobile Menu Toggle",
"category": "theme",
"description": "Progressively reveal the primary navigation on small screens.",
+1 -1
View File
@@ -27,5 +27,5 @@ $chrnx_close_label = __( 'Close primary navigation', 'chrnx' );
data-label-open="<?php echo esc_attr( $chrnx_open_label ); ?>"
data-label-close="<?php echo esc_attr( $chrnx_close_label ); ?>"
>
<span aria-hidden="true">☰</span>
<?php echo chrnx_get_icon_markup( 'menu' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Helper returns a fixed literal SVG. ?>
</button>
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/podcast-meta",
"version": "0.1.0",
"version": "0.4.5",
"title": "Podcast Metadata",
"category": "theme",
"description": "Safe episode details for the current post.",
+13
View File
@@ -0,0 +1,13 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/project-detail",
"version": "0.4.5",
"title": "Project Detail",
"category": "theme",
"description": "Cover, status, description and links for the queried project.",
"textdomain": "chrnx",
"attributes": {},
"supports": { "html": false },
"render": "file:./render.php"
}
+40
View File
@@ -0,0 +1,40 @@
<?php
/**
* Project Detail block render.
*
* @package CHRNX
*/
$chrnx_term = get_queried_object();
if ( ! $chrnx_term instanceof WP_Term || 'chrnx_project' !== $chrnx_term->taxonomy ) {
return;
}
$chrnx_status = (string) get_term_meta( $chrnx_term->term_id, 'chrnx_project_status', true );
$chrnx_cover = absint( get_term_meta( $chrnx_term->term_id, 'chrnx_project_cover', true ) );
$chrnx_links = chrnx_get_project_links( $chrnx_term->term_id );
$chrnx_cover_markup = $chrnx_cover > 0 ? wp_get_attachment_image( $chrnx_cover, 'large', false, array( 'class' => 'chrnx-project-detail__cover' ) ) : '';
// Without status, description or links there is no second column to fill.
$chrnx_has_intro = '' !== $chrnx_status || '' !== $chrnx_term->description || ! empty( $chrnx_links );
$chrnx_head_class = 'chrnx-project-detail__head' . ( $chrnx_has_intro ? '' : ' is-bare' );
?>
<section <?php echo get_block_wrapper_attributes( array( 'class' => 'chrnx-project-detail' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
<div class="<?php echo esc_attr( $chrnx_head_class ); ?>">
<div class="chrnx-project-detail__art">
<?php if ( '' !== $chrnx_cover_markup ) : ?>
<?php echo $chrnx_cover_markup; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
<?php else : ?>
<?php echo chrnx_get_topic_portrait_markup( 'placeholder-project', '', 'chrnx-project-detail__fallback' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Helper returns escaped, allowlisted markup. ?>
<?php endif; ?>
</div>
<div class="chrnx-project-detail__intro">
<?php if ( '' !== $chrnx_status ) : ?>
<p class="chrnx-project-detail__status"><?php echo esc_html( $chrnx_status ); ?></p>
<?php endif; ?>
<?php if ( '' !== $chrnx_term->description ) : ?>
<p class="chrnx-project-detail__description"><?php echo esc_html( $chrnx_term->description ); ?></p>
<?php endif; ?>
<?php echo chrnx_get_platform_links_markup( $chrnx_links, 'chrnx-platform-links', chrnx_get_project_link_slots() ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</div>
</div>
</section>
+15
View File
@@ -0,0 +1,15 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/project-list",
"version": "0.4.5",
"title": "Project List",
"category": "theme",
"description": "Every project, each linking to its own page.",
"textdomain": "chrnx",
"attributes": {
"headingLevel": { "type": "integer", "default": 4, "enum": [2, 3, 4, 5, 6] }
},
"supports": { "html": false },
"render": "file:./render.php"
}
+51
View File
@@ -0,0 +1,51 @@
<?php
/**
* Project List block render.
*
* @package CHRNX
*/
$chrnx_heading = chrnx_get_heading_level( $attributes['headingLevel'] ?? 4, 4 );
$chrnx_terms = get_terms(
array(
'taxonomy' => 'chrnx_project',
'hide_empty' => false,
)
);
if ( is_wp_error( $chrnx_terms ) || empty( $chrnx_terms ) ) {
return;
}
?>
<div <?php echo get_block_wrapper_attributes( array( 'class' => 'chrnx-project-list' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
<?php
foreach ( $chrnx_terms as $chrnx_term ) :
$chrnx_link = get_term_link( $chrnx_term );
$chrnx_status = (string) get_term_meta( $chrnx_term->term_id, 'chrnx_project_status', true );
$chrnx_cover = absint( get_term_meta( $chrnx_term->term_id, 'chrnx_project_cover', true ) );
$chrnx_links = chrnx_get_project_links( $chrnx_term->term_id );
?>
<article class="chrnx-project-card">
<?php if ( ! is_wp_error( $chrnx_link ) ) : ?>
<a class="chrnx-project-card__link" href="<?php echo esc_url( $chrnx_link ); ?>">
<?php endif; ?>
<span class="chrnx-project-card__art">
<?php
$chrnx_cover_markup = $chrnx_cover > 0 ? wp_get_attachment_image( $chrnx_cover, 'chrnx-card', false, array( 'class' => 'chrnx-project-card__cover' ) ) : '';
?>
<?php if ( '' !== $chrnx_cover_markup ) : ?>
<?php echo $chrnx_cover_markup; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
<?php else : ?>
<?php echo chrnx_get_topic_portrait_markup( 'placeholder-project', '', 'chrnx-project-card__fallback' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Helper returns escaped, allowlisted markup. ?>
<?php endif; ?>
</span>
<h<?php echo esc_attr( $chrnx_heading ); ?> class="chrnx-project-card__title"><?php echo esc_html( $chrnx_term->name ); ?></h<?php echo esc_attr( $chrnx_heading ); ?>>
<?php if ( '' !== $chrnx_status ) : ?>
<p class="chrnx-project-card__status"><?php echo esc_html( $chrnx_status ); ?></p>
<?php endif; ?>
<?php if ( ! is_wp_error( $chrnx_link ) ) : ?>
</a>
<?php endif; ?>
<?php echo chrnx_get_platform_links_markup( $chrnx_links, 'chrnx-platform-links', chrnx_get_project_link_slots() ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</article>
<?php endforeach; ?>
</div>
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/reading-time",
"version": "0.1.0",
"version": "0.4.5",
"title": "Reading Time",
"category": "theme",
"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",
"apiVersion": 3,
"name": "chrnx/related-posts",
"version": "0.1.0",
"version": "0.4.5",
"title": "Related Posts",
"category": "theme",
"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-control-background: var(--wp--preset--color--panel);
--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);
max-width: 100%;
+15
View File
@@ -0,0 +1,15 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/release-detail",
"version": "0.4.5",
"title": "Release Detail",
"category": "theme",
"description": "Album cover, listening links, and the ordered tracklist.",
"textdomain": "chrnx",
"attributes": {
"headingLevel": { "type": "integer", "default": 2, "enum": [2, 3, 4, 5, 6] }
},
"supports": { "html": false },
"render": "file:./render.php"
}
+68
View File
@@ -0,0 +1,68 @@
<?php
/**
* Release Detail block render.
*
* @package CHRNX
*/
$chrnx_term = get_queried_object();
if ( ! $chrnx_term instanceof WP_Term || 'chrnx_release' !== $chrnx_term->taxonomy ) {
return;
}
$chrnx_heading = chrnx_get_heading_level( $attributes['headingLevel'] ?? 2, 2 );
$chrnx_status = (string) get_term_meta( $chrnx_term->term_id, 'chrnx_release_status', true );
$chrnx_cover = absint( get_term_meta( $chrnx_term->term_id, 'chrnx_release_cover', true ) );
$chrnx_links = chrnx_get_release_links( $chrnx_term->term_id );
$chrnx_cover_markup = $chrnx_cover > 0 ? wp_get_attachment_image( $chrnx_cover, 'large', false, array( 'class' => 'chrnx-release-detail__cover' ) ) : '';
$chrnx_tracks = chrnx_get_release_track_ids( $chrnx_term->slug );
$chrnx_track_h = min( 6, $chrnx_heading + 1 );
// Without status, description or links there is no second column to fill.
$chrnx_has_intro = '' !== $chrnx_status || '' !== $chrnx_term->description || ! empty( $chrnx_links );
$chrnx_head_class = 'chrnx-release-detail__head' . ( $chrnx_has_intro ? '' : ' is-bare' );
?>
<section <?php echo get_block_wrapper_attributes( array( 'class' => 'chrnx-release-detail' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
<div class="<?php echo esc_attr( $chrnx_head_class ); ?>">
<div class="chrnx-release-detail__art">
<?php if ( '' !== $chrnx_cover_markup ) : ?>
<?php echo $chrnx_cover_markup; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
<?php else : ?>
<?php echo chrnx_get_topic_portrait_markup( 'placeholder-release', '', 'chrnx-release-detail__fallback' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Helper returns escaped, allowlisted markup. ?>
<?php endif; ?>
</div>
<div class="chrnx-release-detail__intro">
<?php if ( '' !== $chrnx_status ) : ?>
<p class="chrnx-release-detail__status"><?php echo esc_html( $chrnx_status ); ?></p>
<?php endif; ?>
<?php if ( '' !== $chrnx_term->description ) : ?>
<p class="chrnx-release-detail__description"><?php echo esc_html( $chrnx_term->description ); ?></p>
<?php endif; ?>
<?php echo chrnx_get_platform_links_markup( $chrnx_links, 'chrnx-platform-links' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</div>
</div>
<?php if ( empty( $chrnx_tracks ) ) : ?>
<p class="chrnx-release-detail__empty"><?php echo esc_html__( 'No published tracks yet.', 'chrnx' ); ?></p>
<?php else : ?>
<ol class="chrnx-tracklist">
<?php
foreach ( $chrnx_tracks as $chrnx_index => $chrnx_track_id ) :
$chrnx_number = absint( get_post_meta( $chrnx_track_id, 'chrnx_track_number', true ) );
$chrnx_player = chrnx_get_track_player_markup( $chrnx_track_id );
?>
<li class="chrnx-tracklist__item">
<span class="chrnx-tracklist__number" aria-hidden="true"><?php echo esc_html( str_pad( (string) ( $chrnx_number > 0 ? $chrnx_number : $chrnx_index + 1 ), 2, '0', STR_PAD_LEFT ) ); ?></span>
<?php if ( '' !== $chrnx_player ) : ?>
<div class="chrnx-tracklist__player"><?php echo $chrnx_player; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></div>
<?php endif; ?>
<div class="chrnx-tracklist__body">
<h<?php echo esc_attr( $chrnx_track_h ); ?> class="chrnx-tracklist__title">
<a href="<?php echo esc_url( get_permalink( $chrnx_track_id ) ); ?>"><?php echo esc_html( get_the_title( $chrnx_track_id ) ); ?></a>
</h<?php echo esc_attr( $chrnx_track_h ); ?>>
<?php echo chrnx_get_platform_links_markup( chrnx_get_track_links( $chrnx_track_id ), 'chrnx-platform-links' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</div>
</li>
<?php endforeach; ?>
</ol>
<?php endif; ?>
</section>
+15
View File
@@ -0,0 +1,15 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/release-list",
"version": "0.4.5",
"title": "Release List",
"category": "theme",
"description": "The No Names releases, each linking to its album page.",
"textdomain": "chrnx",
"attributes": {
"headingLevel": { "type": "integer", "default": 4, "enum": [2, 3, 4, 5, 6] }
},
"supports": { "html": false },
"render": "file:./render.php"
}
+77
View File
@@ -0,0 +1,77 @@
<?php
/**
* Release List block render.
*
* @package CHRNX
*/
$chrnx_heading = chrnx_get_heading_level( $attributes['headingLevel'] ?? 4, 4 );
$chrnx_release_order = array( 'el-hermoso-caos', 'ando-bien-arriba', 'aqui-se-rompio-una-jerga', 'side-b' );
$chrnx_terms = array();
foreach ( $chrnx_release_order as $chrnx_release_slug ) {
$chrnx_release_term = get_term_by( 'slug', $chrnx_release_slug, 'chrnx_release' );
if ( $chrnx_release_term instanceof WP_Term ) {
$chrnx_terms[] = $chrnx_release_term;
}
}
if ( is_wp_error( $chrnx_terms ) || empty( $chrnx_terms ) ) {
return;
}
?>
<div <?php echo get_block_wrapper_attributes( array( 'class' => 'chrnx-release-list' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
<?php
foreach ( $chrnx_terms as $chrnx_term ) :
$chrnx_link = get_term_link( $chrnx_term );
$chrnx_status = (string) get_term_meta( $chrnx_term->term_id, 'chrnx_release_status', true );
$chrnx_cover = absint( get_term_meta( $chrnx_term->term_id, 'chrnx_release_cover', true ) );
$chrnx_links = chrnx_get_release_links( $chrnx_term->term_id );
?>
<article class="chrnx-release-card">
<div class="chrnx-release-card__main">
<span class="chrnx-release-card__art">
<?php
$chrnx_cover_markup = $chrnx_cover > 0 ? wp_get_attachment_image( $chrnx_cover, 'chrnx-card', false, array( 'class' => 'chrnx-release-card__cover' ) ) : '';
?>
<?php if ( '' !== $chrnx_cover_markup ) : ?>
<?php echo $chrnx_cover_markup; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
<?php else : ?>
<?php echo chrnx_get_topic_portrait_markup( 'placeholder-release', '', 'chrnx-release-card__fallback' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Helper returns escaped, allowlisted markup. ?>
<?php endif; ?>
</span>
<div class="chrnx-release-card__content">
<?php if ( ! is_wp_error( $chrnx_link ) ) : ?>
<a class="chrnx-release-card__title-link" href="<?php echo esc_url( $chrnx_link ); ?>">
<?php endif; ?>
<h<?php echo esc_attr( $chrnx_heading ); ?> class="chrnx-release-card__title"><?php echo esc_html( $chrnx_term->name ); ?></h<?php echo esc_attr( $chrnx_heading ); ?>>
<?php
if ( ! is_wp_error( $chrnx_link ) ) :
?>
</a><?php endif; ?>
<?php if ( '' !== $chrnx_status ) : ?>
<p class="chrnx-release-card__status"><?php echo esc_html( $chrnx_status ); ?></p>
<?php endif; ?>
<?php echo chrnx_get_platform_links_markup( $chrnx_links, 'chrnx-platform-links' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
<details class="chrnx-release-card__description">
<summary><?php echo esc_html__( 'Sobre el disco', 'chrnx' ); ?></summary>
<?php if ( '' !== trim( $chrnx_term->description ) ) : ?>
<p><?php echo esc_html( $chrnx_term->description ); ?></p>
<?php else : ?>
<p><?php echo esc_html__( 'Descripción pendiente.', 'chrnx' ); ?></p>
<?php endif; ?>
</details>
<?php $chrnx_preview_tracks = chrnx_get_release_track_ids( $chrnx_term->slug, 3 ); ?>
<?php if ( ! empty( $chrnx_preview_tracks ) ) : ?>
<ol class="chrnx-release-card__tracks">
<?php foreach ( $chrnx_preview_tracks as $chrnx_track_index => $chrnx_track_id ) : ?>
<li><span><?php echo esc_html( str_pad( (string) ( $chrnx_track_index + 1 ), 2, '0', STR_PAD_LEFT ) ); ?></span><a href="<?php echo esc_url( get_permalink( $chrnx_track_id ) ); ?>"><?php echo esc_html( get_the_title( $chrnx_track_id ) ); ?></a></li>
<?php endforeach; ?>
</ol>
<?php endif; ?>
<?php if ( ! is_wp_error( $chrnx_link ) ) : ?>
<a class="chrnx-release-card__lyrics" href="<?php echo esc_url( $chrnx_link ); ?>"><?php echo esc_html__( 'Ver letras', 'chrnx' ); ?> <span aria-hidden="true">↗</span></a>
<?php endif; ?>
</div>
</div>
</article>
<?php endforeach; ?>
</div>
+15
View File
@@ -0,0 +1,15 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/show-links",
"version": "0.4.5",
"title": "Show Links",
"category": "theme",
"description": "Where a podcast show can be listened to, rendered only when a URL exists.",
"textdomain": "chrnx",
"attributes": {
"show": { "type": "string", "default": "" }
},
"supports": { "html": false },
"render": "file:./render.php"
}
+23
View File
@@ -0,0 +1,23 @@
<?php
/**
* Show Links block render.
*
* @package CHRNX
*/
// A named show wins; otherwise fall back to the show archive being viewed.
$chrnx_slug = chrnx_validate_editorial_term_slug( $attributes['show'] ?? '', 'chrnx_show' );
$chrnx_term = '' !== $chrnx_slug ? get_term_by( 'slug', $chrnx_slug, 'chrnx_show' ) : get_queried_object();
if ( ! $chrnx_term instanceof WP_Term || 'chrnx_show' !== $chrnx_term->taxonomy ) {
return;
}
$chrnx_links = chrnx_get_show_links( $chrnx_term->term_id );
if ( empty( $chrnx_links ) ) {
return;
}
?>
<div <?php echo get_block_wrapper_attributes( array( 'class' => 'chrnx-show-links' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
<p class="chrnx-show-links__label"><?php echo esc_html__( 'Listen on', 'chrnx' ); ?></p>
<?php echo chrnx_get_platform_links_markup( $chrnx_links, 'chrnx-platform-links', chrnx_get_show_platforms() ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</div>
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/site-brand",
"version": "0.1.0",
"version": "0.4.5",
"title": "CHRNX Site Brand",
"category": "theme",
"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",
"apiVersion": 3,
"name": "chrnx/subscribe-cta",
"version": "0.1.0",
"version": "0.4.5",
"title": "Subscribe CTA",
"category": "theme",
"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 ) {
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 );
?>
<section <?php echo get_block_wrapper_attributes( array( 'class' => 'chrnx-subscribe-cta' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
+15
View File
@@ -0,0 +1,15 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/subscribe-form",
"version": "0.4.5",
"title": "Subscribe Form",
"category": "theme",
"description": "The email subscription form, rendered only when a provider endpoint is configured.",
"textdomain": "chrnx",
"attributes": {
"headingLevel": { "type": "integer", "default": 2, "enum": [2, 3, 4, 5, 6] }
},
"supports": { "html": false },
"render": "file:./render.php"
}
+35
View File
@@ -0,0 +1,35 @@
<?php
/**
* Subscribe Form block render.
*
* @package CHRNX
*/
$chrnx_endpoint = chrnx_get_subscribe_endpoint();
// Nothing invented: without a configured provider there is no form to show.
if ( '' === $chrnx_endpoint ) {
return;
}
$chrnx_field = chrnx_get_subscribe_field_name();
$chrnx_heading = chrnx_get_heading_level( $attributes['headingLevel'] ?? 2, 2 );
$chrnx_input_id = wp_unique_id( 'chrnx-subscribe-email-' );
?>
<section <?php echo get_block_wrapper_attributes( array( 'class' => 'chrnx-subscribe-form' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
<h<?php echo esc_attr( $chrnx_heading ); ?> class="chrnx-subscribe-form__title"><?php echo esc_html__( 'Get new work by email', 'chrnx' ); ?></h<?php echo esc_attr( $chrnx_heading ); ?>>
<p class="chrnx-subscribe-form__note"><?php echo esc_html__( 'New stories, releases, and episodes. No tracking, and you can leave whenever you want.', 'chrnx' ); ?></p>
<form class="chrnx-subscribe-form__form" method="post" action="<?php echo esc_url( $chrnx_endpoint ); ?>" target="_blank" rel="noopener noreferrer">
<label class="chrnx-subscribe-form__label" for="<?php echo esc_attr( $chrnx_input_id ); ?>"><?php echo esc_html__( 'Email address', 'chrnx' ); ?></label>
<input
class="chrnx-subscribe-form__input"
id="<?php echo esc_attr( $chrnx_input_id ); ?>"
type="email"
name="<?php echo esc_attr( $chrnx_field ); ?>"
autocomplete="email"
inputmode="email"
spellcheck="false"
required
>
<button class="chrnx-subscribe-form__button" type="submit"><?php echo esc_html__( 'Subscribe', 'chrnx' ); ?></button>
</form>
</section>
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/theme-toggle",
"version": "0.1.0",
"version": "0.4.5",
"title": "Theme Toggle",
"category": "theme",
"description": "Choose a light, dark, or system color theme.",
+33 -8
View File
@@ -5,9 +5,23 @@
* @package CHRNX
*/
$chrnx_control_name = wp_unique_id( 'chrnx-theme-' );
$chrnx_panel_id = wp_unique_id( 'chrnx-theme-panel-' );
$chrnx_legend_id = wp_unique_id( 'chrnx-theme-legend-' );
$chrnx_button_label = __( 'Choose color theme', 'chrnx' );
$chrnx_choices = array(
'light' => array(
'label' => __( 'Light', 'chrnx' ),
'icon' => '<circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"/>',
),
'dark' => array(
'label' => __( 'Dark', 'chrnx' ),
'icon' => '<path d="M20 14.5A8.5 8.5 0 0 1 9.5 4a8.5 8.5 0 1 0 10.5 10.5Z"/>',
),
'system' => array(
'label' => __( 'System', 'chrnx' ),
'icon' => '<rect x="3" y="4" width="18" height="12" rx="2"/><path d="M8 20h8M12 16v4"/>',
),
);
?>
<div class="chrnx-theme-control">
<button
@@ -18,10 +32,12 @@ $chrnx_button_label = __( 'Choose color theme', 'chrnx' );
aria-expanded="false"
aria-label="<?php echo esc_attr( $chrnx_button_label ); ?>"
>
<span aria-hidden="true">◐</span>
<?php echo chrnx_get_icon_markup( 'theme' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Helper returns a fixed literal SVG. ?>
</button>
<fieldset
<div
id="<?php echo esc_attr( $chrnx_panel_id ); ?>"
role="group"
aria-labelledby="<?php echo esc_attr( $chrnx_legend_id ); ?>"
<?php
// WordPress escapes each generated wrapper attribute.
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
@@ -38,11 +54,20 @@ $chrnx_button_label = __( 'Choose color theme', 'chrnx' );
data-status-system-light="<?php esc_attr_e( 'Light theme active, following system preference', 'chrnx' ); ?>"
data-status-system-dark="<?php esc_attr_e( 'Dark theme active, following system preference', 'chrnx' ); ?>"
>
<legend><?php esc_html_e( 'Color theme', 'chrnx' ); ?></legend>
<label><input type="radio" name="<?php echo esc_attr( $chrnx_control_name ); ?>" value="light"> <?php esc_html_e( 'Light', 'chrnx' ); ?></label>
<label><input type="radio" name="<?php echo esc_attr( $chrnx_control_name ); ?>" value="dark"> <?php esc_html_e( 'Dark', 'chrnx' ); ?></label>
<label><input type="radio" name="<?php echo esc_attr( $chrnx_control_name ); ?>" value="system" checked> <?php esc_html_e( 'System', 'chrnx' ); ?></label>
<span class="chrnx-theme-toggle__legend" id="<?php echo esc_attr( $chrnx_legend_id ); ?>"><?php esc_html_e( 'Color theme', 'chrnx' ); ?></span>
<?php
foreach ( $chrnx_choices as $chrnx_value => $chrnx_choice ) {
printf(
// The icon geometry is a fixed literal above, never user input.
'<button type="button" data-chrnx-theme-value="%1$s" aria-pressed="%2$s" title="%3$s"><svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">%4$s</svg><span class="chrnx-screen-reader-text">%3$s</span></button>',
esc_attr( $chrnx_value ),
'system' === $chrnx_value ? 'true' : 'false',
esc_html( $chrnx_choice['label'] ),
$chrnx_choice['icon'] // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
);
}
?>
<output data-chrnx-theme-status aria-live="polite"><?php esc_html_e( 'Following system theme', 'chrnx' ); ?></output>
</fieldset>
</div>
<noscript><p class="chrnx-theme-noscript"><?php esc_html_e( 'Enable JavaScript to choose a color theme.', 'chrnx' ); ?></p></noscript>
</div>
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/topic-hero",
"version": "0.1.0",
"version": "0.4.5",
"title": "Topic Hero",
"category": "theme",
"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_size = chrnx_get_topic_art_dimensions( $chrnx_art_topic );
$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_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 ) );
+12
View File
@@ -0,0 +1,12 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/track-meta",
"version": "0.4.5",
"title": "Track Meta",
"category": "theme",
"description": "Player, listening links, and album for one song.",
"textdomain": "chrnx",
"supports": { "html": false },
"render": "file:./render.php"
}
+51
View File
@@ -0,0 +1,51 @@
<?php
/**
* Track Meta block render.
*
* @package CHRNX
*/
$chrnx_post_id = isset( $block->context['postId'] ) ? absint( $block->context['postId'] ) : get_the_ID();
if ( ! chrnx_is_eligible_editorial_post( $chrnx_post_id ) ) {
return;
}
$chrnx_release = chrnx_get_track_release( $chrnx_post_id );
$chrnx_player = chrnx_get_track_player_markup( $chrnx_post_id );
$chrnx_links = chrnx_get_track_links( $chrnx_post_id );
$chrnx_number = absint( get_post_meta( $chrnx_post_id, 'chrnx_track_number', true ) );
$chrnx_description = (string) get_post_meta( $chrnx_post_id, 'chrnx_track_description', true );
// Nothing invented: without any track data this block stays silent.
if ( null === $chrnx_release && '' === $chrnx_player && empty( $chrnx_links ) ) {
return;
}
$chrnx_release_link = null !== $chrnx_release ? get_term_link( $chrnx_release ) : null;
?>
<section <?php echo get_block_wrapper_attributes( array( 'class' => 'chrnx-track-meta' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> aria-label="<?php echo esc_attr__( 'Track details', 'chrnx' ); ?>">
<?php if ( '' !== $chrnx_player ) : ?>
<div class="chrnx-track-meta__player"><?php echo $chrnx_player; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></div>
<?php endif; ?>
<div class="chrnx-track-meta__facts">
<?php if ( null !== $chrnx_release && ! is_wp_error( $chrnx_release_link ) ) : ?>
<p class="chrnx-track-meta__release">
<span class="chrnx-track-meta__label"><?php echo esc_html__( 'From', 'chrnx' ); ?></span>
<a href="<?php echo esc_url( $chrnx_release_link ); ?>"><?php echo esc_html( $chrnx_release->name ); ?></a>
<?php if ( $chrnx_number > 0 ) : ?>
<span class="chrnx-track-meta__number">
<?php
/* translators: %d: track number within the album. */
echo esc_html( sprintf( __( 'Track %d', 'chrnx' ), $chrnx_number ) );
?>
</span>
<?php endif; ?>
</p>
<?php endif; ?>
<?php echo chrnx_get_platform_links_markup( $chrnx_links, 'chrnx-platform-links' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
<?php if ( '' !== trim( $chrnx_description ) ) : ?>
<p class="chrnx-track-meta__description"><?php echo esc_html( $chrnx_description ); ?></p>
<?php endif; ?>
<button class="chrnx-track-meta__share" type="button" data-chrnx-share data-share-title="<?php echo esc_attr( get_the_title( $chrnx_post_id ) ); ?>" data-share-url="<?php echo esc_url( get_permalink( $chrnx_post_id ) ); ?>"><?php echo esc_html__( 'Compartir', 'chrnx' ); ?></button>
</div>
</section>
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,65 @@
# Editorial Widths and Track Pages Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** Unify editorial widths, keep release tracks out of Journal, and add a complete local-first track page.
**Architecture:** Keep tracks as posts with existing release taxonomy and metadata. Add only the missing description/share/audio fixture behavior, scope the Journal query exclusion to release-assigned posts, and use shared width tokens/classes in the theme CSS.
**Tech Stack:** WordPress block theme, PHP render blocks, native HTML audio/share APIs, CSS, Playwright, PHPUnit.
---
### Task 1: Define track-page metadata and Journal eligibility
**Files:**
- Modify: `inc/track-meta.php`
- Modify: `inc/queries.php`
- Test: `tests/php/PatternsTest.php`
- [ ] Add sanitized `chrnx_track_description` post meta and a helper for release-track detection.
- [ ] Exclude posts assigned to `chrnx_release` from unfiltered Journal queries while preserving explicit release queries.
- [ ] Add regression assertions for direct track eligibility and Journal exclusion.
- [ ] Run PHPUnit and fix failures.
### Task 2: Render the track page controls
**Files:**
- Modify: `blocks/track-meta/render.php`
- Modify: `templates/single.html`
- Modify: `assets/js/track-share.js` (create)
- Modify: `inc/blocks.php`
- Test: `tests/e2e/music-podcast-stages.spec.mjs`
- [ ] Render description, player, release, platform links, and share control in a single track metadata surface.
- [ ] Load the share enhancement progressively; use native share when available and clipboard fallback otherwise.
- [ ] Keep lyrics in the existing post content and preserve non-track single-post behavior.
- [ ] Add browser assertions for player/metadata/share and no Journal leakage.
### Task 3: Make the editorial shell consistently wide
**Files:**
- Modify: `assets/css/components.css`
- Test: `tests/e2e/music-podcast-stages.spec.mjs`
- [ ] Apply the centered 1200px editorial width to Journal, Projects, Podcasts, About, release archives, and track pages.
- [ ] Correct Podcast hero centering and preserve mobile stacking/no overflow.
- [ ] Style the track surface with the existing dark/grunge tokens and readable lyric text.
- [ ] Verify both themes and 375/768/1440px captures.
### Task 4: Populate local audio and metadata
**Files:**
- Modify: `scripts/seed-the-no-names-local.php`
- Modify: `README.md`
- [ ] Import available local MP3s from the mounted Suno source as fixture-owned attachments.
- [ ] Populate track descriptions from song metadata when present and keep fake platform URLs local-only.
- [ ] Document the seed command and production cleanup boundary.
### Task 5: Verify and capture
- [ ] Run `npm run lint:css`, `npm run lint:js`, `npm run test:php`, and the focused E2E suite against port 8908.
- [ ] Run `npm run test:smoke`.
- [ ] Capture Music, Podcasts, Journal, Projects, About, and a track page in dark/light desktop/mobile states.
- [ ] Open the final Music and track screenshots in macOS Preview.
@@ -0,0 +1,69 @@
# Music release cards Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** Redesign the local Music release area into wide, expandable The No Names release cards and seed all four local releases from the Suno project.
**Architecture:** Keep the existing dynamic release-list block and taxonomy model. Extend its markup/data boundary for descriptions, track previews, lyrics links, and Side B; use focused CSS for the wider landing layout and responsive card geometry. Add an idempotent local-only seed path rather than coupling production rendering to filesystem paths.
**Tech Stack:** WordPress PHP blocks, CSS, wp-env/Colima, Node smoke and Playwright tests.
---
### Task 1: Lock the local data contract
**Files:**
- Modify: `inc/taxonomies.php`
- Modify: `patterns/music-landing.php`
- Modify: `inc/release-meta.php`
- Modify: `blocks/release-list/render.php`
- Test: `tests/php/PatternsTest.php`
- Test: `tests/smoke/visual-integration.test.mjs`
- [ ] Add Side B as the `side-b` release term after the three existing terms; preserve the existing public slug `el-hermoso-caos` while documenting its longer source-directory mapping.
- [ ] Replace the introductory quote with the approved exact Spanish copy while keeping its existing block position.
- [ ] Extend release list rendering with safe description, status, platform links, track preview, and lyrics destination data.
- [ ] Add semantic disclosure markup and empty-state handling.
- [ ] Add an explicit renderer order array and regression assertions for exactly four releases in order, 13/6/6/19 seeded counts, required release-card structure, and exact quote placement/copy.
- [ ] Run the focused smoke test and confirm it fails before implementation where appropriate.
### Task 2: Implement the release-card presentation
**Files:**
- Modify: `assets/css/components.css`
- Modify: `patterns/music-landing.php`
- Modify: `blocks/release-list/render.php`
- Test: `tests/e2e/music-podcast-stages.spec.mjs`
- Test: `tests/php/BlockRenderingTest.php`
- [ ] Widen only the Music landing content container to a 1200px cap while retaining the existing hero layers and unchanged global 1120px wide size.
- [ ] Build wide release cards with `min(32%, 22rem)` cover width, readable title/status, conditional platform links in Suno/Spotify/Apple order, closed native disclosure, first-three-track preview, per-track links, and release archive lyrics link.
- [ ] Add responsive stacking and keyboard/focus states.
- [ ] Apply grunge texture through existing visual language and restrained metadata treatment, not unreadable body typography.
- [ ] Capture `/music/` with `CHRNX_REVIEW_URL=http://localhost:8908 node scripts/capture-visual-review.mjs` in local light/dark desktop and mobile states.
### Task 3: Seed local The No Names content
**Files:**
- Create: `tests/fixtures/the-no-names-releases.json`
- Modify: `scripts/seed-test-content.php`
- Modify: `scripts/seed-test-content.sh`
- Modify: `README.md`
- Test: `tests/smoke/theme-contract.test.mjs`
- [ ] Add an idempotent `the-no-names` scenario to the existing localhost-guarded seed workflow, reading only `tests/fixtures/the-no-names-releases.json`; include an explicit local generator command that reads the Suno source tree and cannot run against a public host.
- [ ] Include all 13 main-album directories, six tracks from each EP, and 19 Side B tracks; ignore alternate `song-*.md` files.
- [ ] Import source covers into the local media library with `_chrnx_fixture_key` attachments, `_chrnx_fixture_key` terms/posts, term descriptions/status, and clean only prior The No Names fixture records on rerun/restore; switching to default must preserve unrelated content.
- [ ] Keep absent streaming URLs empty and never infer public links.
- [ ] Document startup, seed, preview, and restore boundaries.
- [ ] Run the seed against the isolated wp-env database.
### Task 4: Verify and hand off
**Files:**
- Modify: relevant tests only if evidence requires it.
- [ ] Run `npm run test:smoke`, `npm run lint:js`, `npm run lint:css`, `npm run phpcs`, `npm run test:php`, and `npx playwright test tests/e2e/music-podcast-stages.spec.mjs`.
- [ ] Start Colima/wp-env on the configured local port and capture the rendered page.
- [ ] Inspect screenshots at 375, 768, and 1440 widths in both themes.
- [ ] Run `git diff --check` and report local-only status; do not publish or touch production.
@@ -0,0 +1,119 @@
# CHRNX Projects as First-Class Entities — Design
<!-- markdownlint-disable MD013 -->
**Status:** Approved 2026-08-15
**Supersedes:** the `projects` topic term as a grouping mechanism
## Problem
`projects` is a topic term, so it cannot separate the thing from the writing about it.
Green Tea is a project with a repository, a published package, and a release status.
The posts about Green Tea are a different kind of object. Today both collapse into one
term, and the term cannot hold a repository URL or a cover.
That collapse already produced an inconsistency. Announcement posts landed in
`projects` while deep dives on the same product landed in `code`:
| Product | Announcement | Deep dive |
|---|---|---|
| Expressive Tea | 692 (`projects`) | 695 (`code`) |
| Ailed | 678 (`projects`) | 716 (`code`) |
| Green Tea | 838 (`projects`) | 730 (`code`) |
A reader browsing Green Tea finds half its material. The split exists only because one
term was doing two jobs.
Music and podcasts already solved this. `chrnx_release` is the album, `chrnx_show` is the
programme, and posts reference them. Projects never got the same treatment.
## Solution
Promote projects to an entity taxonomy modelled on `chrnx_release`, and return `code`
to being a general topic about writing code.
### Content model
New taxonomy `chrnx_project`, registered through the existing
`chrnx_register_editorial_taxonomy` contract with `rest_base` `project`.
Seeded terms: `green-tea` (Green Tea), `ailed` (Ailed).
Term meta, mirroring `chrnx_release`:
| Meta key | Type | Sanitizer | Purpose |
|---|---|---|---|
| `chrnx_project_cover` | integer | `absint` | Attachment ID for the project cover |
| `chrnx_project_status` | string | `sanitize_text_field` | Free text, e.g. `Beta`, `Activo`, `Archivado` |
| `chrnx_project_repo` | string | `chrnx_sanitize_https_url` | Source repository |
| `chrnx_project_site` | string | `chrnx_sanitize_https_url` | Documentation or product site |
| `chrnx_project_package` | string | `chrnx_sanitize_https_url` | Where the package lives |
`chrnx_project_package` is deliberately one generic URL rather than an npm-specific
field. Green Tea publishes to npm, a Rust project would publish to crates.io, a Python
one to PyPI. One URL covers all three; a per-registry field list would need editing
every time a new language shows up.
Cover falls back to shared placeholder art when unset, exactly as
`chrnx_release_cover` falls back to `placeholder-release`.
### Retired
`chrnx_project_featured` (post meta), `chrnx_get_selected_project_ids()`, and the
`chrnx/selected-work` block are removed.
Music proves they are unnecessary. `music-landing` lists every release through
`chrnx/release-list` with no notion of a featured release, and `home-music` carries no
list at all. With two or three projects, picking a favourite is ceremony, not curation.
The `projects` topic term is retired. Posts that carried it move to `code`, and grouping
moves to their project term.
### Surfaces
| Surface | Today | After |
|---|---|---|
| `/projects/` page (740) | `chrnx/home-projects` pattern + `journal-stream {"topic":"projects"}` | `chrnx/projects-landing` pattern |
| Project archive | none | `templates/taxonomy-chrnx_project.html` |
| Home section | `chrnx/selected-work` inside `home-projects` | banner copy only, mirroring `home-music` |
The landing gets a character-stage banner in the established three-layer shape
(atmosphere, content, art), followed by `chrnx/project-list`.
Landing copy, in the author's voice:
> **Proyectos**
> Aquí va lo que mi cerebro tira en formato de código.
> Una noche me agarra la loquera y sale código. A veces sirve, a veces nomás me deja
> dormir. Lo que sobrevive lo dejo aquí, con su repo y su estado real, sin adornos.
### Debt repaid alongside
`chrnx_show` has no `taxonomy-chrnx_show.html` and falls through to the generic archive,
so a podcast programme page never renders its own detail block. Adding
`templates/taxonomy-chrnx_show.html` alongside the project template closes that gap
while the same shape is fresh.
## Migration
Pages store pattern references rather than expanded markup, so theme changes propagate
without touching stored content. Verified on production:
```text
740 /projects/ <!-- wp:pattern {"slug":"chrnx/home-projects"} /-->
<!-- wp:chrnx/journal-stream {"topic":"projects"} /-->
743 /music/ <!-- wp:pattern {"slug":"chrnx/music-landing"} /-->
```
One stored block breaks: `journal-stream {"topic":"projects"}` on page 740, because its
topic disappears. Page 740 becomes a single `chrnx/projects-landing` pattern reference.
Six published posts need project terms assigned and their topic corrected. The exact
post-to-project mapping is supplied by the author, not inferred.
## Non-goals
- No custom post type. Projects are terms, like releases and shows.
- No per-registry package fields.
- No project-level prose page beyond the term description.
- No changes to `chrnx_release`, `chrnx_show`, Related Stories, or theme preference.
@@ -0,0 +1,29 @@
# Editorial Widths and Track Pages Design
## Goal
Make the editorial pages feel like one site-wide system while giving The No
Names tracks a proper listening page instead of treating every song as a
Journal entry.
## Approved behavior
- Journal, Projects, Podcasts, About, release archives, and track pages share a
centered desktop content width of approximately 1200px and responsive side
gutters.
- Podcast hero and its latest-conversation section use the same centered width
without changing the existing visual language.
- Posts assigned to `chrnx_release` are excluded from the general Journal
stream, but remain directly accessible and appear in release tracklists.
- A track page renders its native MP3 player when audio is attached, track
description, release/platform metadata, a share control with copy fallback,
and the existing lyric content.
- Platform URLs and audio attachments are optional; absent data leaves no empty
controls. Local fixtures may use fake URLs and sample MP3s, but production
migration must not copy them.
## Boundaries
The work changes the existing post-based track model rather than introducing a
new post type. No production data or public URLs are changed. The existing
Journal remains the home for non-track editorial posts.
@@ -0,0 +1,29 @@
# Music release cards design
## Goal
Preserve the existing Music landing composition while making its release area wider, more useful, and specific to The No Names.
## Approved design
The Music hero, collage, musician, AI quote area, and visual language remain intact. The introductory quote changes to the exact copy below and remains in the existing quote block, below the hero and above the releases:
> Miren, miren: esto es, virtualmente, lo que la voz de Kurt Cobain le hizo a mi cabeza, pasado por una IA generativa. Si vienes con AI SLOP, déjame decirte que me vale veinte mil hectáreas de verga. La letra, la voz y la producción vienen de una tormenta que vive permanentemente en mi cabeza. Si no te gusta, ahí está la puerta. Yo nomás aviso: no habrá conciertos. Así nomás.
The main content width uses a Music-only 1200px desktop cap (the existing theme wide size remains unchanged elsewhere) and full-width with 1rem gutters on mobile, without changing the hero's layered composition. The `Releases in progress` area renders four independent release cards in this order: public slug `el-hermoso-caos` mapped to source directory `el-hermoso-caos-que-habita-en-mi-cerebro` (13 tracks), `ando-bien-arriba` (6), `aqui-se-rompio-una-jerga` (6), and `side-b` (19 experimental tracks). Each card uses a square cover constrained to `min(32%, 22rem)` on desktop, a title/status/platform-link column, a native `<details><summary>` description disclosure closed by default, the first three ordered tracks (or all available tracks when fewer than three exist), and a `Ver letras` link to `/release/<slug>/`. On mobile the cover stacks above the content. Platform links appear in the fixed order Suno, Spotify, Apple Music, only when a valid HTTPS URL exists; local fixtures leave all three empty.
## Data and local boundary
The local fixture is the named `the-no-names` scenario in `scripts/seed-test-content.sh`, guarded to `localhost`/`127.0.0.1` and reading only the checked-in generated snapshot `tests/fixtures/the-no-names-releases.json`; generation from `/Users/chrnx/projects/suno/bands/the-no-names` is a separate local command and never runs from a public host. The snapshot maps each `disc.md`, each numbered `song.md` (alternate `song-*.md` files are ignored), and approved 1200px cover file to a release record. Side B is an independent `chrnx_release` term. Descriptions come from the first Concept paragraphs; release statuses use the disc `status` value with unknown/empty values rendered as `En proceso`; track posts use the song title and status. Seed-owned terms use `_chrnx_fixture_key`, posts use `_chrnx_fixture_key`, and attachments use `_chrnx_fixture_key`; rerun replaces only those records and `restore` removes only those records. Missing audio and platform URLs remain empty. Production is not contacted or mutated.
## Typography
Keep body and lyric text readable. Use distressed/grunge treatment on release labels, headings, borders, and background texture rather than applying an extreme decorative font to long lyrics. Any font addition must be local or explicitly approved; no runtime third-party font dependency is required for this increment.
## Interaction and accessibility
Descriptions use native `<details><summary>` semantics, closed by default, with keyboard support, visible focus states, and readable contrast. `Ver letras` links to the release archive URL and each visible track title links to its individual post when present. Each external link uses `target="_blank" rel="noopener noreferrer external"` and an accessible platform name. Missing artwork, links, status, and descriptions render gracefully; the release card still renders with its title and track preview.
## Verification
Run `npm run test:smoke`, `npm run lint:js`, `npm run lint:css`, `npm run phpcs`, `npm run test:php`, and `npx playwright test tests/e2e/music-podcast-stages.spec.mjs` against `http://localhost:8908` (the isolated override). Capture `/music/` locally in dark and light themes at 375px, 768px, and 1440px. Acceptance requires exactly four cards in the declared order, seeded counts 13/6/6/19, native disclosures closed by default, valid conditional platform links, lyrics/archive links, no horizontal overflow, and no public-host access from the seed command.
+2 -2
View File
@@ -1,8 +1,8 @@
<?php
define( 'CHRNX_VERSION', '0.1.0' );
define( 'CHRNX_VERSION', '0.4.5' );
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
foreach ( array( 'setup', 'assets', 'taxonomies', 'editor', 'podcast-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 ) {
// phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
$path = get_theme_file_path( "inc/{$module}.php" );
if ( file_exists( $path ) ) {
+9
View File
@@ -27,5 +27,14 @@ function chrnx_enqueue_assets() {
array( 'chrnx-layout' ),
CHRNX_VERSION
);
if ( is_singular( 'post' ) ) {
wp_enqueue_script(
'chrnx-track-share',
get_theme_file_uri( 'assets/js/track-share.js' ),
array(),
CHRNX_VERSION,
true
);
}
}
add_action( 'wp_enqueue_scripts', 'chrnx_enqueue_assets' );
+103 -6
View File
@@ -29,7 +29,7 @@ function chrnx_get_current_navigation_destination() {
return '';
}
if ( is_home() || is_search() || is_singular( 'post' ) || is_tax( array( 'chrnx_topic', 'chrnx_language', 'chrnx_show' ) ) ) {
if ( is_home() || is_search() || is_singular( 'post' ) || is_tax( array( 'chrnx_topic', 'chrnx_language', 'chrnx_show', 'chrnx_project' ) ) ) {
return $journal_url;
}
@@ -95,9 +95,106 @@ function chrnx_get_card_media_markup( $post_id, $class_name ) {
array( 'class' => $class_name . '__image' )
);
}
// A track with no art of its own borrows its album cover before falling back.
$release = function_exists( 'chrnx_get_track_release' ) ? chrnx_get_track_release( $post_id ) : null;
if ( null !== $release ) {
$cover_id = absint( get_term_meta( $release->term_id, 'chrnx_release_cover', true ) );
if ( $cover_id > 0 ) {
return wp_get_attachment_image(
$cover_id,
'chrnx-card',
false,
array( 'class' => $class_name . '__image' )
);
}
}
$topic = chrnx_get_post_topic_slug( $post_id );
$class = $class_name . '__fallback' . ( '' !== $topic ? ' is-topic-' . sanitize_html_class( $topic ) : '' );
return '<span class="' . esc_attr( $class ) . '" aria-hidden="true"></span>';
return chrnx_get_topic_portrait_markup( 'placeholder-post', '', $class );
}
/**
* Return the navigation links for one theme menu location.
*
* The built-in list is a fallback, not a contract: a site whose pages are named
* differently would otherwise get a header full of 404s.
*
* @param string $location Registered menu location.
* @return array<int,array<string,string>> Label and URL pairs.
*/
function chrnx_get_navigation_links( $location ) {
$assigned = get_nav_menu_locations();
$menu_id = isset( $assigned[ $location ] ) ? absint( $assigned[ $location ] ) : 0;
if ( $menu_id > 0 ) {
$items = wp_get_nav_menu_items( $menu_id );
if ( is_array( $items ) ) {
$links = array();
foreach ( $items as $item ) {
// Only top-level entries: the header is a single flat row.
if ( absint( $item->menu_item_parent ) > 0 ) {
continue;
}
$url = esc_url_raw( (string) $item->url );
$label = trim( wp_strip_all_tags( (string) $item->title ) );
if ( '' !== $url && '' !== $label ) {
$links[] = array(
'label' => $label,
'url' => $url,
);
}
}
if ( ! empty( $links ) ) {
return $links;
}
}
}
$defaults = array( 'journal', 'projects', 'music', 'podcasts', 'about' );
$labels = array(
'journal' => __( 'Journal', 'chrnx' ),
'projects' => __( 'Projects', 'chrnx' ),
'music' => __( 'Music', 'chrnx' ),
'podcasts' => __( 'Podcasts', 'chrnx' ),
'about' => __( 'About', 'chrnx' ),
);
$links = array();
foreach ( $defaults as $slug ) {
$links[] = array(
'label' => $labels[ $slug ],
'url' => home_url( '/' . $slug . '/' ),
);
}
return $links;
}
/**
* Render one allowlisted interface icon.
*
* Unicode glyphs render inconsistently across platforms and fonts, so every
* control icon comes from this one place instead.
*
* @param string $name Allowlisted icon name.
* @param int $size Square pixel size.
* @return string Escaped inline SVG, or an empty string for unknown names.
*/
function chrnx_get_icon_markup( $name, $size = 20 ) {
$icons = array(
'search' => '<circle cx="11" cy="11" r="7"/><path d="M20 20l-3.6-3.6"/>',
'menu' => '<path d="M4 7h16M4 12h16M4 17h16"/>',
'theme' => '<circle cx="12" cy="12" r="9"/><path d="M12 3a9 9 0 0 1 0 18Z" fill="currentColor" stroke="none"/>',
);
if ( ! isset( $icons[ $name ] ) ) {
return '';
}
return sprintf(
// The path data is a fixed literal, never user input.
'<svg viewBox="0 0 24 24" width="%1$d" height="%1$d" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">%2$s</svg>',
absint( $size ),
$icons[ $name ] // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
);
}
/**
@@ -115,16 +212,16 @@ function chrnx_get_editorial_card_markup( $post_id, $heading_level = 3, $class_n
$post = get_post( $post_id );
$heading_level = chrnx_get_heading_level( $heading_level, 3 );
$topic_terms = get_the_terms( $post_id, 'chrnx_topic' );
$topic_label = ! is_wp_error( $topic_terms ) && ! empty( $topic_terms ) ? $topic_terms[0]->name : '';
// A card without a topic left an empty slot and knocked the row out of alignment.
// Untopiced posts are still Journal entries, so that is the honest fallback.
$topic_label = ! is_wp_error( $topic_terms ) && ! empty( $topic_terms ) ? $topic_terms[0]->name : __( 'Journal', 'chrnx' );
$excerpt = wp_trim_words( wp_strip_all_tags( get_the_excerpt( $post ) ), 24 );
$markup = '<article class="' . esc_attr( $class_name ) . '">';
$markup .= '<a class="' . esc_attr( $class_name . '__link' ) . '" href="' . esc_url( get_permalink( $post ) ) . '">';
$markup .= chrnx_get_card_media_markup( $post_id, $class_name );
$markup .= '<span class="' . esc_attr( $class_name . '__content' ) . '">';
if ( '' !== $topic_label ) {
$markup .= '<span class="' . esc_attr( $class_name . '__badge' ) . '">' . esc_html( $topic_label ) . '</span>';
}
$markup .= '<h' . $heading_level . ' class="' . esc_attr( $class_name . '__title' ) . '">' . esc_html( get_the_title( $post ) ) . '</h' . $heading_level . '>';
if ( '' !== $excerpt ) {
$markup .= '<span class="' . esc_attr( $class_name . '__excerpt' ) . '">' . esc_html( $excerpt ) . '</span>';
@@ -135,7 +232,7 @@ function chrnx_get_editorial_card_markup( $post_id, $heading_level = 3, $class_n
/** Register all block metadata directories that exist. */
function chrnx_register_editorial_blocks() {
$blocks = array( 'featured-stories', 'journal-stream', 'latest-podcast', 'podcast-meta', 'topic-hero', 'related-posts', 'subscribe-cta', 'theme-toggle', 'site-brand', 'mobile-menu-toggle', 'footer-content', 'header-tools', 'reading-time', 'journal-link' );
$blocks = array( 'featured-stories', 'journal-stream', 'latest-podcast', 'podcast-meta', 'topic-hero', 'related-posts', 'subscribe-cta', 'theme-toggle', 'site-brand', 'mobile-menu-toggle', 'footer-content', 'header-tools', 'reading-time', 'journal-link', 'release-list', 'release-detail', 'track-meta', 'subscribe-form', 'show-links', 'project-list', 'project-detail' );
foreach ( $blocks as $block ) {
$name = 'chrnx/' . $block;
if ( WP_Block_Type_Registry::get_instance()->is_registered( $name ) ) {
+9
View File
@@ -45,7 +45,16 @@ function chrnx_enqueue_editor_assets() {
true
);
wp_enqueue_script(
'chrnx-editor-track',
get_theme_file_uri( 'assets/js/editor-track.js' ),
array( 'wp-block-editor', 'wp-components', 'wp-core-data', 'wp-data', 'wp-edit-post', 'wp-element', 'wp-i18n', 'wp-plugins' ),
CHRNX_VERSION,
true
);
wp_set_script_translations( 'chrnx-editor-taxonomies', 'chrnx', get_theme_file_path( 'languages' ) );
wp_set_script_translations( 'chrnx-editor-podcast', 'chrnx', get_theme_file_path( 'languages' ) );
wp_set_script_translations( 'chrnx-editor-track', 'chrnx', get_theme_file_path( 'languages' ) );
}
add_action( 'enqueue_block_editor_assets', 'chrnx_enqueue_editor_assets' );
+6 -3
View File
@@ -37,7 +37,10 @@ function chrnx_get_topic_portrait_markup( string $topic_slug, string $alt = '',
$markup = '<picture class="chrnx-responsive-portrait"' . $decorative . '>';
$markup .= '<source type="image/avif" srcset="' . esc_url( $base_uri . '-384.avif' ) . ' 384w, ' . esc_url( $base_uri . '-768.avif' ) . ' 768w" sizes="' . esc_attr( $sizes ) . '">';
$markup .= '<source type="image/webp" srcset="' . esc_url( $base_uri . '-384.webp' ) . ' 384w, ' . esc_url( $base_uri . '-768.webp' ) . ' 768w" sizes="' . esc_attr( $sizes ) . '">';
$markup .= '<img' . ( '' !== $class ? ' class="' . esc_attr( $class ) . '"' : '' ) . ' src="' . esc_url( get_theme_file_uri( $source ) ) . '" width="' . esc_attr( $dimensions[0] ) . '" height="' . esc_attr( $dimensions[1] ) . '" loading="' . esc_attr( $loading ) . '"' . $priority . ' decoding="async" sizes="' . esc_attr( $sizes ) . '" alt="' . esc_attr( $alt ) . '">';
// The fallback is the 768 WebP, not the multi-megabyte master: every browser
// that renders <picture> has supported WebP since 2020, and shipping design
// masters as a runtime fallback cost megabytes per image.
$markup .= '<img' . ( '' !== $class ? ' class="' . esc_attr( $class ) . '"' : '' ) . ' src="' . esc_url( $base_uri . '-768.webp' ) . '" width="' . esc_attr( $dimensions[0] ) . '" height="' . esc_attr( $dimensions[1] ) . '" loading="' . esc_attr( $loading ) . '"' . $priority . ' decoding="async" sizes="' . esc_attr( $sizes ) . '" alt="' . esc_attr( $alt ) . '">';
$markup .= '</picture>';
return $markup;
@@ -51,7 +54,7 @@ function chrnx_get_topic_portrait_markup( string $topic_slug, string $alt = '',
* @return string Safe picture markup or an empty string.
*/
function chrnx_get_atmosphere_markup( string $asset_key, string $class_name = '' ): string {
if ( 'podcast-frequency' !== $asset_key ) {
if ( ! in_array( $asset_key, array( 'podcast-frequency', 'about-grunge', 'projects-grunge' ), true ) ) {
return '';
}
@@ -73,7 +76,7 @@ function chrnx_get_atmosphere_markup( string $asset_key, string $class_name = ''
$markup = '<picture class="chrnx-responsive-atmosphere" aria-hidden="true">';
$markup .= '<source type="image/avif" srcset="' . esc_url( $base_uri . '-384.avif' ) . ' 384w, ' . esc_url( $base_uri . '-768.avif' ) . ' 768w, ' . esc_url( $base_uri . '-1536.avif' ) . ' 1536w" sizes="' . esc_attr( $sizes ) . '">';
$markup .= '<source type="image/webp" srcset="' . esc_url( $base_uri . '-384.webp' ) . ' 384w, ' . esc_url( $base_uri . '-768.webp' ) . ' 768w, ' . esc_url( $base_uri . '-1536.webp' ) . ' 1536w" sizes="' . esc_attr( $sizes ) . '">';
$markup .= '<img' . ( '' !== $class ? ' class="' . esc_attr( $class ) . '"' : '' ) . ' src="' . esc_url( get_theme_file_uri( $source ) ) . '" width="' . esc_attr( $dimensions[0] ) . '" height="' . esc_attr( $dimensions[1] ) . '" loading="' . esc_attr( $loading ) . '" decoding="async" sizes="' . esc_attr( $sizes ) . '" alt="' . esc_attr( $alt ) . '">';
$markup .= '<img' . ( '' !== $class ? ' class="' . esc_attr( $class ) . '"' : '' ) . ' src="' . esc_url( $base_uri . '-1536.webp' ) . '" width="' . esc_attr( $dimensions[0] ) . '" height="' . esc_attr( $dimensions[1] ) . '" loading="' . esc_attr( $loading ) . '" decoding="async" sizes="' . esc_attr( $sizes ) . '" alt="' . esc_attr( $alt ) . '">';
$markup .= '</picture>';
return $markup;
+149
View File
@@ -0,0 +1,149 @@
<?php
/**
* Project term metadata.
*
* @package CHRNX
*/
/**
* Return the outbound link slots a project can carry.
*
* One generic package slot rather than one field per registry: Green Tea ships
* to npm, a Rust project would ship to crates.io, a Python one to PyPI. A
* per-registry list would need editing every time a new language shows up.
*
* @return array<string,array<string,string>> Slot key to label and icon.
*/
function chrnx_get_project_link_slots() {
return array(
'repo' => array(
'label' => __( 'Repository', 'chrnx' ),
'icon' => '<path d="M9 19c-5 1.5-5-2.5-7-3"/><path d="M15 22v-4a3.4 3.4 0 0 0-1-2.6c3-.3 6-1.5 6-6.6a5 5 0 0 0-1.4-3.5 4.6 4.6 0 0 0-.1-3.5s-1.1-.3-3.5 1.3a12 12 0 0 0-6 0C6.6 1.5 5.5 1.8 5.5 1.8a4.6 4.6 0 0 0-.1 3.5A5 5 0 0 0 4 8.8c0 5.1 3 6.3 6 6.6a3.4 3.4 0 0 0-1 2.6v4"/>',
),
'package' => array(
'label' => __( 'Package', 'chrnx' ),
'icon' => '<path d="m7.5 4.3 9 5.2"/><path d="M21 16V8a2 2 0 0 0-1-1.7l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.7l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16"/><path d="M3.3 7 12 12l8.7-5"/><path d="M12 22V12"/>',
),
'site' => array(
'label' => __( 'Website', 'chrnx' ),
'icon' => '<circle cx="12" cy="12" r="10"/><path d="M12 2a15 15 0 0 1 0 20"/><path d="M12 2a15 15 0 0 0 0 20"/><path d="M2 12h20"/>',
),
);
}
/**
* Return the project term meta keys and their sanitizers.
*
* @return array<string,string> Meta key to sanitize callback.
*/
function chrnx_get_project_meta_definitions() {
$definitions = array(
'chrnx_project_cover' => 'absint',
'chrnx_project_status' => 'sanitize_text_field',
);
foreach ( array_keys( chrnx_get_project_link_slots() ) as $slot ) {
$definitions[ 'chrnx_project_' . $slot ] = 'chrnx_sanitize_https_url';
}
return $definitions;
}
/**
* Register project term metadata.
*/
function chrnx_register_project_meta() {
foreach ( chrnx_get_project_meta_definitions() as $meta_key => $sanitize ) {
register_term_meta(
'chrnx_project',
$meta_key,
array(
'type' => 'chrnx_project_cover' === $meta_key ? 'integer' : 'string',
'single' => true,
'show_in_rest' => true,
'sanitize_callback' => $sanitize,
'auth_callback' => 'chrnx_auth_release_meta',
)
);
}
}
add_action( 'init', 'chrnx_register_project_meta' );
/**
* Return the stored outbound links for one project.
*
* @param int $term_id Project term ID.
* @return array<string,string> Slot key to URL, omitting empty ones.
*/
function chrnx_get_project_links( $term_id ) {
$links = array();
foreach ( array_keys( chrnx_get_project_link_slots() ) as $slot ) {
$url = chrnx_sanitize_https_url( get_term_meta( $term_id, 'chrnx_project_' . $slot, true ) );
if ( '' !== $url ) {
$links[ $slot ] = $url;
}
}
return $links;
}
/**
* Render the project metadata fields on the term edit screen.
*
* @param WP_Term $term Project term.
*/
function chrnx_render_project_edit_fields( $term ) {
chrnx_print_release_field(
'chrnx_project_status',
__( 'Status', 'chrnx' ),
(string) get_term_meta( $term->term_id, 'chrnx_project_status', true ),
'text',
__( 'Short and honest, for example Beta, Activo or Archivado.', 'chrnx' )
);
foreach ( chrnx_get_project_link_slots() as $slot => $definition ) {
chrnx_print_release_field(
'chrnx_project_' . $slot,
$definition['label'],
(string) get_term_meta( $term->term_id, 'chrnx_project_' . $slot, true ),
'url',
__( 'HTTPS only. Leave empty to hide this icon.', 'chrnx' )
);
}
chrnx_print_release_field(
'chrnx_project_cover',
__( 'Cover attachment ID', 'chrnx' ),
(string) absint( get_term_meta( $term->term_id, 'chrnx_project_cover', true ) ),
'text',
__( 'Leave empty to use the shared placeholder art.', 'chrnx' )
);
}
add_action( 'chrnx_project_edit_form_fields', 'chrnx_render_project_edit_fields' );
/**
* Persist project term metadata from the term edit screen.
*
* @param int $term_id Project term ID.
*/
function chrnx_save_project_meta( $term_id ) {
if ( ! chrnx_auth_release_meta() ) {
return;
}
// Core supplies and verifies the add/update term nonce on these screens.
$nonce = isset( $_POST['_wpnonce'] ) ? sanitize_text_field( wp_unslash( $_POST['_wpnonce'] ) ) : '';
if ( ! wp_verify_nonce( $nonce, 'update-tag_' . $term_id ) && ! wp_verify_nonce( $nonce, 'add-tag' ) ) {
return;
}
foreach ( chrnx_get_project_meta_definitions() as $meta_key => $sanitize ) {
if ( ! isset( $_POST[ $meta_key ] ) ) {
continue;
}
$value = call_user_func( $sanitize, wp_unslash( $_POST[ $meta_key ] ) ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Sanitized by the mapped callback.
if ( '' === $value || 0 === $value ) {
delete_term_meta( $term_id, $meta_key );
continue;
}
update_term_meta( $term_id, $meta_key, $value );
}
}
add_action( 'edited_chrnx_project', 'chrnx_save_project_meta' );
add_action( 'created_chrnx_project', 'chrnx_save_project_meta' );
+37 -5
View File
@@ -124,6 +124,12 @@ function chrnx_get_eligible_editorial_post_ids( $extra_args = array() ) {
'cache_results' => false,
'suppress_filters' => false,
'chrnx_require_nonempty_title' => true,
'tax_query' => array(
array(
'taxonomy' => 'chrnx_release',
'operator' => 'NOT EXISTS',
),
),
),
$extra_args,
array( 'posts_per_page' => $limit )
@@ -321,7 +327,7 @@ function chrnx_sanitize_journal_search( $value ) {
*/
function chrnx_get_journal_archive_filter( $queried_object = null ): array {
$queried_object = null === $queried_object ? get_queried_object() : $queried_object;
if ( ! $queried_object instanceof WP_Term || ! in_array( $queried_object->taxonomy, array( 'chrnx_topic', 'chrnx_language', 'chrnx_show' ), true ) ) {
if ( ! $queried_object instanceof WP_Term || ! in_array( $queried_object->taxonomy, array( 'chrnx_topic', 'chrnx_language', 'chrnx_show', 'chrnx_project' ), true ) ) {
return array();
}
@@ -378,7 +384,7 @@ function chrnx_get_journal_base_url() {
$url = get_permalink( $queried );
return is_string( $url ) ? $url : '';
}
if ( $queried instanceof WP_Term && in_array( $queried->taxonomy, array( 'chrnx_topic', 'chrnx_language', 'chrnx_show' ), true ) ) {
if ( $queried instanceof WP_Term && in_array( $queried->taxonomy, array( 'chrnx_topic', 'chrnx_language', 'chrnx_show', 'chrnx_project' ), true ) ) {
$url = get_term_link( $queried );
return is_wp_error( $url ) ? '' : $url;
}
@@ -433,7 +439,7 @@ function chrnx_get_full_journal_url() {
function chrnx_get_journal_page_url( int $page, array $filters ) {
$base_url = chrnx_get_journal_base_url();
$args = array();
foreach ( array( 'chrnx_topic', 'chrnx_language', 'chrnx_show' ) as $taxonomy ) {
foreach ( array( 'chrnx_topic', 'chrnx_language', 'chrnx_show', 'chrnx_project' ) as $taxonomy ) {
$slug = chrnx_validate_editorial_term_slug( $filters[ $taxonomy ] ?? '', $taxonomy );
if ( '' !== $slug ) {
$args[ $taxonomy ] = $slug;
@@ -473,7 +479,7 @@ function chrnx_get_journal_query_args( array $request ): array {
);
$tax_query = array();
foreach ( array( 'chrnx_topic', 'chrnx_language', 'chrnx_show' ) as $taxonomy ) {
foreach ( array( 'chrnx_topic', 'chrnx_language', 'chrnx_show', 'chrnx_project' ) as $taxonomy ) {
$value = $request[ $taxonomy ] ?? '';
$slug = chrnx_validate_editorial_term_slug( $value, $taxonomy );
if ( '' !== $slug ) {
@@ -487,6 +493,13 @@ function chrnx_get_journal_query_args( array $request ): array {
if ( ! empty( $tax_query ) ) {
$args['tax_query'] = $tax_query;
}
$args['tax_query'][] = array(
'taxonomy' => 'chrnx_release',
'operator' => 'NOT EXISTS',
);
if ( 1 < count( $args['tax_query'] ) ) {
$args['tax_query']['relation'] = 'AND';
}
$search = chrnx_sanitize_journal_search( $request['s'] ?? '' );
if ( '' !== $search ) {
@@ -626,10 +639,16 @@ function chrnx_get_topic_art_asset( string $topic_slug ): string {
$mapping = array(
'research' => 'alter-ego-research.png',
'code' => 'alter-ego-code.png',
'projects' => 'alter-ego-code.png',
'literature' => 'alter-ego-literature.png',
'music' => 'the-no-names-musician-cutout.png',
'music-collage' => 'the-no-names-collage.jpeg',
'podcast-frequency' => 'podcast-frequency-grunge.png',
'about-grunge' => 'about-grunge.png',
'placeholder-post' => 'placeholder-post.png',
'placeholder-release' => 'placeholder-release.png',
'placeholder-project' => 'placeholder-project.png',
'projects-grunge' => 'projects-grunge.png',
'podcasts' => 'alter-ego-podcasts.png',
'life' => 'alter-ego-life.png',
'gaming' => 'alter-ego-gaming-half-body.png',
@@ -648,9 +667,22 @@ function chrnx_get_topic_art_dimensions( string $topic_slug ): array {
return array();
}
if ( 'podcast-frequency' === $topic_slug ) {
// The landscape atmosphere backgrounds share one intrinsic size.
if ( in_array( $topic_slug, array( 'podcast-frequency', 'about-grunge', 'projects-grunge' ), true ) ) {
return array( 1536, 1024 );
}
if ( 'placeholder-post' === $topic_slug ) {
return array( 1440, 960 );
}
if ( 'placeholder-release' === $topic_slug ) {
return array( 1536, 1536 );
}
if ( 'placeholder-project' === $topic_slug ) {
return array( 1534, 1025 );
}
return 'gaming' === $topic_slug ? array( 1024, 1536 ) : array( 1122, 1402 );
}
+259
View File
@@ -0,0 +1,259 @@
<?php
/**
* Release (album) term metadata and shared platform links.
*
* @package CHRNX
*/
/**
* Return the supported streaming platforms in display order.
*
* @return array<string,array<string,string>> Platform key to label and icon path data.
*/
function chrnx_get_release_platforms() {
return array(
'suno' => array(
'label' => __( 'Suno', 'chrnx' ),
'icon' => '<path d="M12 3a9 9 0 1 0 9 9"/><path d="M8 12a4 4 0 1 0 4-4"/>',
),
'spotify' => array(
'label' => __( 'Spotify', 'chrnx' ),
'icon' => '<circle cx="12" cy="12" r="9"/><path d="M7.5 9.5c3-.8 6.2-.5 8.8 1M8 12.6c2.4-.6 5-.4 7.2.9M8.6 15.6c1.9-.5 4-.3 5.7.7"/>',
),
'apple' => array(
'label' => __( 'Apple Music', 'chrnx' ),
'icon' => '<path d="M9 18V6.5l9-1.5V16"/><circle cx="7" cy="18" r="2"/><circle cx="16" cy="16" r="2"/>',
),
);
}
/**
* Sanitize an external listening URL and require HTTPS.
*
* @param mixed $value Submitted value.
* @return string Valid HTTPS URL or an empty string.
*/
function chrnx_sanitize_https_url( $value ) {
if ( ! is_string( $value ) ) {
return '';
}
$url = esc_url_raw( trim( $value ) );
$scheme = wp_parse_url( $url, PHP_URL_SCHEME );
$host = wp_parse_url( $url, PHP_URL_HOST );
return '' !== $url && 'https' === $scheme && ! empty( $host ) ? $url : '';
}
/**
* Return the release term meta keys and their sanitizers.
*
* @return array<string,callable-string> Meta key to sanitize callback.
*/
function chrnx_get_release_meta_definitions() {
$definitions = array(
'chrnx_release_cover' => 'absint',
'chrnx_release_status' => 'sanitize_text_field',
);
foreach ( array_keys( chrnx_get_release_platforms() ) as $platform ) {
$definitions[ 'chrnx_release_url_' . $platform ] = 'chrnx_sanitize_https_url';
}
return $definitions;
}
/**
* Require permission to manage release term metadata.
*
* @return bool Whether the current user can manage categories.
*/
function chrnx_auth_release_meta() {
return current_user_can( 'manage_categories' );
}
/**
* Register release term metadata.
*/
function chrnx_register_release_meta() {
foreach ( chrnx_get_release_meta_definitions() as $meta_key => $sanitize ) {
register_term_meta(
'chrnx_release',
$meta_key,
array(
'type' => 'chrnx_release_cover' === $meta_key ? 'integer' : 'string',
'single' => true,
'show_in_rest' => true,
'sanitize_callback' => $sanitize,
'auth_callback' => 'chrnx_auth_release_meta',
)
);
}
}
add_action( 'init', 'chrnx_register_release_meta' );
/**
* Return the stored external links for one release term.
*
* @param int $term_id Release term ID.
* @return array<string,string> Platform key to URL, omitting empty ones.
*/
function chrnx_get_release_links( $term_id ) {
$links = array();
foreach ( array_keys( chrnx_get_release_platforms() ) as $platform ) {
$url = chrnx_sanitize_https_url( get_term_meta( $term_id, 'chrnx_release_url_' . $platform, true ) );
if ( '' !== $url ) {
$links[ $platform ] = $url;
}
}
return $links;
}
/**
* Render a row of platform links, or nothing when none are stored.
*
* @param array<string,string> $links Platform key to URL.
* @param string $class_name Wrapper class.
* @param array<string,array>|null $platforms Platform definitions, defaulting to releases.
* @return string Escaped markup or an empty string.
*/
function chrnx_get_platform_links_markup( array $links, $class_name = 'chrnx-platform-links', $platforms = null ) {
$platforms = is_array( $platforms ) ? $platforms : chrnx_get_release_platforms();
$items = '';
foreach ( $links as $platform => $url ) {
if ( ! isset( $platforms[ $platform ] ) ) {
continue;
}
$items .= sprintf(
// The icon path data is a fixed literal, never user input.
'<li><a class="%1$s__link" href="%2$s" target="_blank" rel="noopener noreferrer external"><svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">%3$s</svg><span class="%1$s__label">%4$s</span></a></li>',
esc_attr( $class_name ),
esc_url( $url ),
$platforms[ $platform ]['icon'], // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
esc_html( $platforms[ $platform ]['label'] )
);
}
if ( '' === $items ) {
return '';
}
return '<ul class="' . esc_attr( $class_name ) . '">' . $items . '</ul>';
}
/**
* Print one release meta field row for the term edit screen.
*
* @param string $meta_key Meta key.
* @param string $label Field label.
* @param string $value Current value.
* @param string $type Input type.
* @param string $help Optional description.
*/
function chrnx_print_release_field( $meta_key, $label, $value, $type = 'url', $help = '' ) {
printf(
'<tr class="form-field"><th scope="row"><label for="%1$s">%2$s</label></th><td><input name="%1$s" id="%1$s" type="%3$s" value="%4$s" class="regular-text"%5$s>%6$s</td></tr>',
esc_attr( $meta_key ),
esc_html( $label ),
esc_attr( $type ),
esc_attr( $value ),
'chrnx_release_cover' === $meta_key ? ' data-chrnx-release-cover' : '',
'' !== $help ? '<p class="description">' . esc_html( $help ) . '</p>' : ''
);
}
/**
* Render the release metadata fields on the term edit screen.
*
* @param WP_Term $term Release term.
*/
function chrnx_render_release_edit_fields( $term ) {
$cover_id = absint( get_term_meta( $term->term_id, 'chrnx_release_cover', true ) );
chrnx_print_release_field(
'chrnx_release_cover',
__( 'Cover image ID', 'chrnx' ),
(string) ( $cover_id > 0 ? $cover_id : '' ),
'number',
__( 'Media library attachment ID for the album artwork.', 'chrnx' )
);
echo '<tr class="form-field"><th scope="row"></th><td>';
echo '<button type="button" class="button" data-chrnx-release-cover-pick>' . esc_html__( 'Select cover', 'chrnx' ) . '</button>';
echo '<div data-chrnx-release-cover-preview>';
if ( $cover_id > 0 ) {
echo wp_get_attachment_image( $cover_id, 'medium' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Core returns escaped markup.
}
echo '</div></td></tr>';
chrnx_print_release_field(
'chrnx_release_status',
__( 'Status', 'chrnx' ),
(string) get_term_meta( $term->term_id, 'chrnx_release_status', true ),
'text',
__( 'Shown under the title, for example: 13-track debut album — in production.', 'chrnx' )
);
foreach ( chrnx_get_release_platforms() as $platform => $definition ) {
chrnx_print_release_field(
'chrnx_release_url_' . $platform,
/* translators: %s: streaming platform name. */
sprintf( __( '%s URL', 'chrnx' ), $definition['label'] ),
(string) get_term_meta( $term->term_id, 'chrnx_release_url_' . $platform, true ),
'url',
__( 'HTTPS only. Leave empty to hide this icon.', 'chrnx' )
);
}
}
add_action( 'chrnx_release_edit_form_fields', 'chrnx_render_release_edit_fields' );
/**
* Persist release term metadata from the term edit screen.
*
* @param int $term_id Release term ID.
*/
function chrnx_save_release_meta( $term_id ) {
if ( ! chrnx_auth_release_meta() ) {
return;
}
// Core supplies and verifies the add/update term nonce on these screens.
$nonce = isset( $_POST['_wpnonce'] ) ? sanitize_text_field( wp_unslash( $_POST['_wpnonce'] ) ) : '';
if ( ! wp_verify_nonce( $nonce, 'update-tag_' . $term_id ) && ! wp_verify_nonce( $nonce, 'add-tag' ) ) {
return;
}
foreach ( chrnx_get_release_meta_definitions() as $meta_key => $sanitize ) {
if ( ! isset( $_POST[ $meta_key ] ) ) {
continue;
}
$value = call_user_func( $sanitize, wp_unslash( $_POST[ $meta_key ] ) ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Sanitized by the mapped callback.
if ( '' === $value || 0 === $value ) {
delete_term_meta( $term_id, $meta_key );
continue;
}
update_term_meta( $term_id, $meta_key, $value );
}
}
add_action( 'edited_chrnx_release', 'chrnx_save_release_meta' );
add_action( 'created_chrnx_release', 'chrnx_save_release_meta' );
/**
* Enqueue the media picker only on the release term screen.
*
* @param string $hook_suffix Current admin page.
*/
function chrnx_enqueue_release_admin_assets( $hook_suffix ) {
$taxonomy = isset( $_GET['taxonomy'] ) ? sanitize_key( wp_unslash( $_GET['taxonomy'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only screen routing.
if ( ! in_array( $hook_suffix, array( 'term.php', 'edit-tags.php' ), true ) || 'chrnx_release' !== $taxonomy ) {
return;
}
wp_enqueue_media();
wp_enqueue_script(
'chrnx-admin-release',
get_theme_file_uri( 'assets/js/admin-release.js' ),
array( 'media-editor' ),
CHRNX_VERSION,
true
);
}
add_action( 'admin_enqueue_scripts', 'chrnx_enqueue_release_admin_assets' );
+96
View File
@@ -70,3 +70,99 @@ function chrnx_get_subscribe_url(): string {
$url = get_permalink( $page );
return is_string( $url ) ? $url : '';
}
/**
* Sanitize the subscription form endpoint and require HTTPS.
*
* @param mixed $value Submitted option value.
* @return string Valid HTTPS URL or an empty string.
*/
function chrnx_sanitize_subscribe_endpoint( $value ) {
return chrnx_sanitize_https_url( $value );
}
/**
* Sanitize the provider's email field name.
*
* @param mixed $value Submitted option value.
* @return string Safe field name, defaulting to email.
*/
function chrnx_sanitize_subscribe_field( $value ) {
if ( ! is_string( $value ) ) {
return 'email';
}
$name = trim( $value );
// Providers use names like email, EMAIL, or fields[email].
return 1 === preg_match( '/^[A-Za-z0-9_\[\]-]{1,64}$/', $name ) ? $name : 'email';
}
/** Render the subscription endpoint field. */
function chrnx_render_subscribe_endpoint_field() {
printf(
'<input type="url" name="chrnx_subscribe_endpoint" id="chrnx_subscribe_endpoint" value="%s" class="regular-text" placeholder="https://">',
esc_attr( (string) get_option( 'chrnx_subscribe_endpoint', '' ) )
);
echo '<p class="description">' . esc_html__( 'HTTPS form endpoint from your email provider. Leave empty to hide the form.', 'chrnx' ) . '</p>';
}
/** Render the subscription email field-name input. */
function chrnx_render_subscribe_field_field() {
printf(
'<input type="text" name="chrnx_subscribe_field" id="chrnx_subscribe_field" value="%s" class="regular-text">',
esc_attr( chrnx_get_subscribe_field_name() )
);
echo '<p class="description">' . esc_html__( 'Name of the email input your provider expects, for example email or EMAIL.', 'chrnx' ) . '</p>';
}
/** Register the subscription form settings and Reading fields. */
function chrnx_register_subscribe_form_settings() {
register_setting(
'reading',
'chrnx_subscribe_endpoint',
array(
'type' => 'string',
'default' => '',
'sanitize_callback' => 'chrnx_sanitize_subscribe_endpoint',
)
);
register_setting(
'reading',
'chrnx_subscribe_field',
array(
'type' => 'string',
'default' => 'email',
'sanitize_callback' => 'chrnx_sanitize_subscribe_field',
)
);
add_settings_field(
'chrnx_subscribe_endpoint',
esc_html__( 'Subscribe form endpoint', 'chrnx' ),
'chrnx_render_subscribe_endpoint_field',
'reading'
);
add_settings_field(
'chrnx_subscribe_field',
esc_html__( 'Subscribe email field name', 'chrnx' ),
'chrnx_render_subscribe_field_field',
'reading'
);
}
add_action( 'admin_init', 'chrnx_register_subscribe_form_settings' );
/**
* Return the configured subscription form endpoint.
*
* @return string Valid HTTPS endpoint or an empty string.
*/
function chrnx_get_subscribe_endpoint(): string {
return chrnx_sanitize_https_url( get_option( 'chrnx_subscribe_endpoint', '' ) );
}
/**
* Return the configured email field name.
*
* @return string Safe field name.
*/
function chrnx_get_subscribe_field_name(): string {
return chrnx_sanitize_subscribe_field( get_option( 'chrnx_subscribe_field', 'email' ) );
}
+155 -1
View File
@@ -13,9 +13,163 @@ function chrnx_setup() {
add_theme_support( 'post-thumbnails' );
add_theme_support( 'responsive-embeds' );
add_theme_support( 'editor-styles' );
add_editor_style( array( 'assets/css/base.css', 'assets/css/layout.css' ) );
add_editor_style( array( 'assets/css/base.css', 'assets/css/layout.css', 'assets/css/components.css' ) );
remove_action( 'wp_footer', 'the_block_template_skip_link' );
add_image_size( 'chrnx-card', 720, 480, true );
register_nav_menus(
array(
'chrnx-primary' => __( 'Primary navigation', 'chrnx' ),
'chrnx-footer' => __( 'Footer navigation', 'chrnx' ),
)
);
// No template renders a comment thread, so nothing is collected silently.
remove_post_type_support( 'post', 'comments' );
remove_post_type_support( 'page', 'comments' );
}
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.
*
* 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() {
if ( chrnx_has_seo_plugin() ) {
return;
}
if ( is_singular() ) {
$title = get_the_title();
$url = get_permalink();
$description = wp_strip_all_tags( get_the_excerpt() );
$type = 'article';
$image_id = get_post_thumbnail_id();
} else {
$title = get_bloginfo( 'name' );
$url = home_url( '/' );
$description = get_bloginfo( 'description' );
$type = 'website';
$image_id = 0;
}
// Generated derivative, not the design master: masters are not shipped.
$image = $image_id
? wp_get_attachment_image_url( $image_id, 'full' )
: get_theme_file_uri( 'assets/images/generated/about-grunge-1536.webp' );
$tags = array(
'og:site_name' => get_bloginfo( 'name' ),
'og:type' => $type,
'og:title' => $title,
'og:description' => $description,
'og:url' => $url,
'og:image' => $image,
);
foreach ( $tags as $property => $content ) {
if ( '' === $content ) {
continue;
}
printf(
'<meta property="%1$s" content="%2$s" />' . "\n",
esc_attr( $property ),
esc_attr( $content )
);
}
echo '<meta name="twitter:card" content="summary_large_image" />' . "\n";
}
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 );
+129
View File
@@ -0,0 +1,129 @@
<?php
/**
* Show (podcast programme) term metadata.
*
* @package CHRNX
*/
/**
* Return the platforms a show can be listened on.
*
* Shares the release icons but not their labels: a podcast lives on Apple
* Podcasts, not Apple Music.
*
* @return array<string,array<string,string>> Platform key to label and icon.
*/
function chrnx_get_show_platforms() {
$release = chrnx_get_release_platforms();
return array(
'spotify' => $release['spotify'],
'apple' => array(
'label' => __( 'Apple Podcasts', 'chrnx' ),
'icon' => $release['apple']['icon'],
),
'rss' => array(
'label' => __( 'RSS feed', 'chrnx' ),
'icon' => '<path d="M5 19a1 1 0 1 0 0-2 1 1 0 0 0 0 2"/><path d="M5 12a7 7 0 0 1 7 7"/><path d="M5 5a14 14 0 0 1 14 14"/>',
),
);
}
/**
* Return the show term meta keys and their sanitizers.
*
* @return array<string,string> Meta key to sanitize callback.
*/
function chrnx_get_show_meta_definitions() {
$definitions = array();
foreach ( array_keys( chrnx_get_show_platforms() ) as $platform ) {
$definitions[ 'chrnx_show_url_' . $platform ] = 'chrnx_sanitize_https_url';
}
return $definitions;
}
/**
* Register show term metadata.
*/
function chrnx_register_show_meta() {
foreach ( chrnx_get_show_meta_definitions() as $meta_key => $sanitize ) {
register_term_meta(
'chrnx_show',
$meta_key,
array(
'type' => 'string',
'single' => true,
'show_in_rest' => true,
'sanitize_callback' => $sanitize,
'auth_callback' => 'chrnx_auth_release_meta',
)
);
}
}
add_action( 'init', 'chrnx_register_show_meta' );
/**
* Return the stored listening links for one show.
*
* @param int $term_id Show term ID.
* @return array<string,string> Platform key to URL, omitting empty ones.
*/
function chrnx_get_show_links( $term_id ) {
$links = array();
foreach ( array_keys( chrnx_get_show_platforms() ) as $platform ) {
$url = chrnx_sanitize_https_url( get_term_meta( $term_id, 'chrnx_show_url_' . $platform, true ) );
if ( '' !== $url ) {
$links[ $platform ] = $url;
}
}
return $links;
}
/**
* Render the show metadata fields on the term edit screen.
*
* @param WP_Term $term Show term.
*/
function chrnx_render_show_edit_fields( $term ) {
foreach ( chrnx_get_show_platforms() as $platform => $definition ) {
chrnx_print_release_field(
'chrnx_show_url_' . $platform,
/* translators: %s: listening platform name. */
sprintf( __( '%s URL', 'chrnx' ), $definition['label'] ),
(string) get_term_meta( $term->term_id, 'chrnx_show_url_' . $platform, true ),
'url',
__( 'HTTPS only. Leave empty to hide this icon.', 'chrnx' )
);
}
}
add_action( 'chrnx_show_edit_form_fields', 'chrnx_render_show_edit_fields' );
/**
* Persist show term metadata from the term edit screen.
*
* @param int $term_id Show term ID.
*/
function chrnx_save_show_meta( $term_id ) {
if ( ! chrnx_auth_release_meta() ) {
return;
}
// Core supplies and verifies the add/update term nonce on these screens.
$nonce = isset( $_POST['_wpnonce'] ) ? sanitize_text_field( wp_unslash( $_POST['_wpnonce'] ) ) : '';
if ( ! wp_verify_nonce( $nonce, 'update-tag_' . $term_id ) && ! wp_verify_nonce( $nonce, 'add-tag' ) ) {
return;
}
foreach ( chrnx_get_show_meta_definitions() as $meta_key => $sanitize ) {
if ( ! isset( $_POST[ $meta_key ] ) ) {
continue;
}
$value = call_user_func( $sanitize, wp_unslash( $_POST[ $meta_key ] ) ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Sanitized by the mapped callback.
if ( '' === $value ) {
delete_term_meta( $term_id, $meta_key );
continue;
}
update_term_meta( $term_id, $meta_key, $value );
}
}
add_action( 'edited_chrnx_show', 'chrnx_save_show_meta' );
add_action( 'created_chrnx_show', 'chrnx_save_show_meta' );
+69 -2
View File
@@ -19,6 +19,7 @@ function chrnx_get_editorial_taxonomies() {
'terms' => array(
'research' => __( 'Research', 'chrnx' ),
'code' => __( 'Code', 'chrnx' ),
'projects' => __( 'Projects', 'chrnx' ),
'literature' => __( 'Literature', 'chrnx' ),
'music' => __( 'Music', 'chrnx' ),
'podcasts' => __( 'Podcasts', 'chrnx' ),
@@ -43,6 +44,26 @@ function chrnx_get_editorial_taxonomies() {
'silicon-ranch' => __( 'Silicon Ranch', 'chrnx' ),
),
),
'chrnx_release' => array(
'singular' => __( 'Release', 'chrnx' ),
'plural' => __( 'Releases', 'chrnx' ),
'rest_base' => 'release',
'terms' => array(
'el-hermoso-caos' => __( 'El Hermoso Caos que habita en mi cabeza', 'chrnx' ),
'ando-bien-arriba' => __( 'Ando Bien Arriba', 'chrnx' ),
'aqui-se-rompio-una-jerga' => __( 'Aquí se Rompió una Jerga', 'chrnx' ),
'side-b' => __( 'Side B', 'chrnx' ),
),
),
'chrnx_project' => array(
'singular' => __( 'Project', 'chrnx' ),
'plural' => __( 'Projects', 'chrnx' ),
'rest_base' => 'project',
'terms' => array(
'green-tea' => __( 'Green Tea', 'chrnx' ),
'ailed' => __( 'Ailed', 'chrnx' ),
),
),
);
}
@@ -91,17 +112,63 @@ function chrnx_seed_editorial_terms() {
}
foreach ( $definition['terms'] as $slug => $name ) {
if ( ! term_exists( $slug, $taxonomy_name ) ) {
/*
* term_exists() reads a cache that is not always warm during theme
* activation, which let a second activation insert duplicates with
* a "-2" slug. Ask the taxonomy directly, by slug and by name.
*/
if ( get_term_by( 'slug', $slug, $taxonomy_name ) instanceof WP_Term ) {
continue;
}
if ( get_term_by( 'name', $name, $taxonomy_name ) instanceof WP_Term ) {
continue;
}
$result = wp_insert_term( $name, $taxonomy_name, array( 'slug' => $slug ) );
if ( is_wp_error( $result ) || false === $result ) {
chrnx_store_editorial_notice( '', 'vocabulary_setup_failed' );
}
}
}
}
}
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.
*
Loaded 100 of 147 files, more files were not shown because too many files have changed in this diff. Show more