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
@@ -2,13 +2,14 @@
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 3,
|
||||
"name": "chrnx/journal-stream",
|
||||
"version": "0.1.0",
|
||||
"version": "0.2.0",
|
||||
"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",
|
||||
|
||||
@@ -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,12 @@ $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 ); ?>>
|
||||
<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>
|
||||
|
||||
Reference in new issue
Block a user