Files
chrnx-dev-wp/inc/editor.php
T
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

70 lines
2.2 KiB
PHP

<?php
/**
* Block editor assets.
*
* @package CHRNX
*/
/**
* Determine whether a screen is the post block editor.
*
* @param mixed $screen Potential WordPress screen.
* @return bool Whether editor assets belong on the screen.
*/
function chrnx_is_post_block_editor_screen( $screen ) {
return is_object( $screen ) &&
isset( $screen->base, $screen->post_type ) &&
'post' === $screen->base &&
'post' === $screen->post_type &&
is_callable( array( $screen, 'is_block_editor' ) ) &&
$screen->is_block_editor();
}
/**
* Enqueue CHRNX controls only in the post block editor.
*/
function chrnx_enqueue_editor_assets() {
$screen = function_exists( 'get_current_screen' ) ? get_current_screen() : null;
if ( ! chrnx_is_post_block_editor_screen( $screen ) ) {
return;
}
wp_enqueue_script(
'chrnx-editor-taxonomies',
get_theme_file_uri( 'assets/js/editor-taxonomies.js' ),
array( 'wp-components', 'wp-core-data', 'wp-data', 'wp-edit-post', 'wp-element', 'wp-i18n', 'wp-plugins' ),
CHRNX_VERSION,
true
);
wp_enqueue_script(
'chrnx-editor-podcast',
get_theme_file_uri( 'assets/js/editor-podcast.js' ),
array( 'wp-components', 'wp-core-data', 'wp-data', 'wp-edit-post', 'wp-element', 'wp-i18n', 'wp-plugins' ),
CHRNX_VERSION,
true
);
wp_enqueue_script(
'chrnx-editor-project',
get_theme_file_uri( 'assets/js/editor-project.js' ),
array( 'wp-components', 'wp-core-data', 'wp-data', 'wp-edit-post', 'wp-element', 'wp-i18n', 'wp-plugins' ),
CHRNX_VERSION,
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-project', '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' );