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>
27 lines
1.1 KiB
PHP
27 lines
1.1 KiB
PHP
<?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>
|