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:
chrnxandClaude Opus 5 committed 2026-08-13 19:41:24 -05:00
1 parent a3ba692669
commit f55d9d9b45
14 files changed
+539 -31

No files matched your search

+77 -10
View File
@@ -262,6 +262,59 @@ 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.
*
@@ -624,15 +677,20 @@ function chrnx_get_related_post_ids( int $post_id, int $limit = 3 ): array {
*/
function chrnx_get_topic_art_asset( string $topic_slug ): string {
$mapping = array(
'research' => 'alter-ego-research.png',
'code' => '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',
'podcasts' => 'alter-ego-podcasts.png',
'life' => 'alter-ego-life.png',
'gaming' => 'alter-ego-gaming-half-body.png',
'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',
'projects-grunge' => 'projects-grunge.png',
'podcasts' => 'alter-ego-podcasts.png',
'life' => 'alter-ego-life.png',
'gaming' => 'alter-ego-gaming-half-body.png',
);
return isset( $mapping[ $topic_slug ] ) ? 'assets/images/' . $mapping[ $topic_slug ] : '';
}
@@ -648,9 +706,18 @@ 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 );
}
return 'gaming' === $topic_slug ? array( 1024, 1536 ) : array( 1122, 1402 );
}