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
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 3,
|
||||
"name": "chrnx/selected-work",
|
||||
"version": "0.2.0",
|
||||
"title": "Selected Work",
|
||||
"category": "theme",
|
||||
"description": "Hand-picked projects first, then the most recent ones.",
|
||||
"textdomain": "chrnx",
|
||||
"attributes": {
|
||||
"limit": { "type": "integer", "default": 3, "minimum": 1, "maximum": 12 },
|
||||
"headingLevel": { "type": "integer", "default": 3, "enum": [2, 3, 4, 5, 6] }
|
||||
},
|
||||
"supports": { "html": false },
|
||||
"render": "file:./render.php"
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* Selected Work block render.
|
||||
*
|
||||
* @package CHRNX
|
||||
*/
|
||||
|
||||
$chrnx_limit = isset( $attributes['limit'] ) ? min( 12, max( 1, absint( $attributes['limit'] ) ) ) : 3;
|
||||
$chrnx_heading = chrnx_get_heading_level( $attributes['headingLevel'] ?? 3, 3 );
|
||||
$chrnx_ids = chrnx_get_selected_project_ids( $chrnx_limit );
|
||||
?>
|
||||
<div <?php echo get_block_wrapper_attributes( array( 'class' => 'chrnx-selected-work' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
|
||||
<?php if ( empty( $chrnx_ids ) ) : ?>
|
||||
<p class="chrnx-selected-work__empty"><?php echo esc_html__( 'No projects published yet.', 'chrnx' ); ?></p>
|
||||
<?php else : ?>
|
||||
<ul class="chrnx-selected-work__list">
|
||||
<?php foreach ( $chrnx_ids as $chrnx_project_id ) : ?>
|
||||
<li class="chrnx-selected-work__item">
|
||||
<h<?php echo esc_attr( $chrnx_heading ); ?> class="chrnx-selected-work__title">
|
||||
<a href="<?php echo esc_url( get_permalink( $chrnx_project_id ) ); ?>"><?php echo esc_html( get_the_title( $chrnx_project_id ) ); ?></a>
|
||||
</h<?php echo esc_attr( $chrnx_heading ); ?>>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
Reference in new issue
Block a user