feat: add editorial query blocks

This commit is contained in:
chrnx committed 2026-08-11 15:27:44 -05:00
1 parent 835fb74ebf
commit 89dcc53e02
24 files changed
+1421

No files matched your search

+16
View File
@@ -0,0 +1,16 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/latest-podcast",
"version": "0.1.0",
"title": "Latest Podcast",
"category": "theme",
"description": "A linked card for the latest podcast episode.",
"textdomain": "chrnx",
"attributes": {
"headingLevel": { "type": "integer", "default": 2, "enum": [2, 3, 4, 5, 6] }
},
"supports": { "html": false, "align": ["wide", "full"] },
"style": "file:./style.css",
"render": "file:./render.php"
}
+16
View File
@@ -0,0 +1,16 @@
<?php
/**
* Latest Podcast block render.
*
* @package CHRNX
*/
$chrnx_post_id = chrnx_get_latest_podcast_id();
if ( 0 === $chrnx_post_id ) {
return;
}
$chrnx_heading = chrnx_get_heading_level( $attributes['headingLevel'] ?? 2, 2 );
?>
<section <?php echo get_block_wrapper_attributes( array( 'class' => 'chrnx-latest-podcast' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> aria-label="<?php echo esc_attr__( 'Latest podcast', 'chrnx' ); ?>">
<?php echo chrnx_get_editorial_card_markup( $chrnx_post_id, $chrnx_heading, 'chrnx-podcast-card' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</section>
+16
View File
@@ -0,0 +1,16 @@
.chrnx-latest-podcast {
border: 1px solid var(--wp--preset--color--border, currentcolor);
padding: var(--wp--preset--spacing--40, 1.5rem);
}
.chrnx-podcast-card__image,
.chrnx-podcast-card__fallback {
aspect-ratio: 3 / 2;
display: block;
object-fit: cover;
width: 100%;
}
.chrnx-podcast-card__fallback {
background: linear-gradient(135deg, var(--wp--preset--color--green), var(--wp--preset--color--violet));
}