refactor: drop the featured-project picker in favour of the project list
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
12 files changed
+6
-362
No files matched your search
+1
-1
@@ -232,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', 'selected-work', 'release-list', 'release-detail', 'track-meta', 'subscribe-form', 'show-links', 'project-list', 'project-detail' );
|
||||
$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 ) ) {
|
||||
|
||||
@@ -45,14 +45,6 @@ function chrnx_enqueue_editor_assets() {
|
||||
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' ),
|
||||
@@ -63,7 +55,6 @@ function chrnx_enqueue_editor_assets() {
|
||||
|
||||
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' );
|
||||
@@ -262,59 +262,6 @@ function chrnx_get_featured_story_ids( int $limit = 3 ): array {
|
||||
return $selected;
|
||||
}
|
||||
|
||||
/**
|
||||
* Select projects for the Selected work stage: hand-picked first, then recent.
|
||||
*
|
||||
* Sticky already belongs to the home featured stories, so the editorial choice
|
||||
* lives in its own per-post flag instead of competing for the same signal.
|
||||
*
|
||||
* @param int $limit Maximum projects, bounded to 12.
|
||||
* @return int[] Selected project post IDs.
|
||||
*/
|
||||
function chrnx_get_selected_project_ids( int $limit = 3 ): array {
|
||||
$limit = min( 12, max( 0, $limit ) );
|
||||
if ( 0 === $limit ) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$topic_query = array(
|
||||
array(
|
||||
'taxonomy' => 'chrnx_topic',
|
||||
'field' => 'slug',
|
||||
'terms' => 'projects',
|
||||
),
|
||||
);
|
||||
|
||||
$selected = chrnx_get_eligible_editorial_post_ids(
|
||||
array(
|
||||
'posts_per_page' => $limit,
|
||||
'tax_query' => $topic_query,
|
||||
'meta_query' => array(
|
||||
array(
|
||||
'key' => 'chrnx_project_featured',
|
||||
'value' => '1',
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
$remaining = $limit - count( $selected );
|
||||
if ( $remaining > 0 ) {
|
||||
$selected = array_merge(
|
||||
$selected,
|
||||
chrnx_get_eligible_editorial_post_ids(
|
||||
array(
|
||||
'posts_per_page' => $remaining,
|
||||
'post__not_in' => $selected,
|
||||
'tax_query' => $topic_query,
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return $selected;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate a request taxonomy slug against an existing editorial term.
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user