Files
chrnx-dev-wp/blocks/release-list/render.php
T
chrnxandClaude Opus 5 20c47c927a feat: give releases and tracks their own pages
Albums were three hardcoded cards. An album is a chrnx_release term
now, with cover, status and listening links; its archive is the album
page with an ordered tracklist. A song is a post carrying lyrics and
notes, its track number, and the audio.

The player is a native audio element, no library and no JavaScript.
Platform icons render only when a URL exists, so nothing points at a
service the release is not on yet.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-13 19:41:36 -05:00

49 lines
2.1 KiB
PHP

<?php
/**
* Release List block render.
*
* @package CHRNX
*/
$chrnx_heading = chrnx_get_heading_level( $attributes['headingLevel'] ?? 4, 4 );
$chrnx_terms = get_terms(
array(
'taxonomy' => 'chrnx_release',
'hide_empty' => false,
)
);
if ( is_wp_error( $chrnx_terms ) || empty( $chrnx_terms ) ) {
return;
}
?>
<div <?php echo get_block_wrapper_attributes( array( 'class' => 'chrnx-release-list' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
<?php
foreach ( $chrnx_terms as $chrnx_term ) :
$chrnx_link = get_term_link( $chrnx_term );
$chrnx_status = (string) get_term_meta( $chrnx_term->term_id, 'chrnx_release_status', true );
$chrnx_cover = absint( get_term_meta( $chrnx_term->term_id, 'chrnx_release_cover', true ) );
$chrnx_links = chrnx_get_release_links( $chrnx_term->term_id );
?>
<article class="chrnx-release-card">
<?php if ( ! is_wp_error( $chrnx_link ) ) : ?>
<a class="chrnx-release-card__link" href="<?php echo esc_url( $chrnx_link ); ?>">
<?php endif; ?>
<span class="chrnx-release-card__art">
<?php if ( $chrnx_cover > 0 ) : ?>
<?php echo wp_get_attachment_image( $chrnx_cover, 'chrnx-card', false, array( 'class' => 'chrnx-release-card__cover' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
<?php else : ?>
<?php echo chrnx_get_topic_portrait_markup( 'placeholder-release', '', 'chrnx-release-card__fallback' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Helper returns escaped, allowlisted markup. ?>
<?php endif; ?>
</span>
<h<?php echo esc_attr( $chrnx_heading ); ?> class="chrnx-release-card__title"><?php echo esc_html( $chrnx_term->name ); ?></h<?php echo esc_attr( $chrnx_heading ); ?>>
<?php if ( '' !== $chrnx_status ) : ?>
<p class="chrnx-release-card__status"><?php echo esc_html( $chrnx_status ); ?></p>
<?php endif; ?>
<?php if ( ! is_wp_error( $chrnx_link ) ) : ?>
</a>
<?php endif; ?>
<?php echo chrnx_get_platform_links_markup( $chrnx_links, 'chrnx-platform-links' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</article>
<?php endforeach; ?>
</div>