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>
This commit is contained in:
14 files changed
+539
-31
No files matched your search
+26
-5
@@ -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,16 @@ 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' ),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -91,11 +102,21 @@ function chrnx_seed_editorial_terms() {
|
||||
}
|
||||
|
||||
foreach ( $definition['terms'] as $slug => $name ) {
|
||||
if ( ! term_exists( $slug, $taxonomy_name ) ) {
|
||||
$result = wp_insert_term( $name, $taxonomy_name, array( 'slug' => $slug ) );
|
||||
if ( is_wp_error( $result ) || false === $result ) {
|
||||
chrnx_store_editorial_notice( '', 'vocabulary_setup_failed' );
|
||||
}
|
||||
/*
|
||||
* 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' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user