Files
chrnx-dev-wp/blocks/featured-stories/render.php
T

24 lines
889 B
PHP

<?php
/**
* Featured Stories 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'] ?? 2, 2 );
$chrnx_ids = chrnx_get_featured_story_ids( $chrnx_limit );
if ( empty( $chrnx_ids ) ) {
return;
}
?>
<section <?php echo get_block_wrapper_attributes( array( 'class' => 'chrnx-featured-stories' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> aria-label="<?php echo esc_attr__( 'Featured stories', 'chrnx' ); ?>">
<div class="chrnx-featured-stories__grid">
<?php
foreach ( $chrnx_ids as $chrnx_post_id ) {
echo chrnx_get_editorial_card_markup( $chrnx_post_id, $chrnx_heading, 'chrnx-featured-story' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
?>
</div>
</section>