fix: hide empty show metadata

This commit is contained in:
bisco
2026-06-25 17:50:53 +02:00
parent f49026b317
commit 9c5a51745f
5 changed files with 17 additions and 4 deletions
+3 -1
View File
@@ -119,11 +119,13 @@ $features = array(
$fallback = azionelab_asset( 0 === $show_index % 2 ? 'show-one.svg' : 'show-two.svg' );
$image = get_the_post_thumbnail_url( get_the_ID(), 'large' ) ?: $fallback;
$year = get_post_meta( get_the_ID(), 'azl_show_year', true );
$year = '0' === (string) $year ? '' : $year;
$location = get_post_meta( get_the_ID(), 'azl_show_location', true );
$show_meta = implode( ' · ', array_filter( array( $year, $location ) ) );
?>
<article class="show-card">
<img src="<?php echo esc_url( $image ); ?>" alt="Locandina di <?php the_title_attribute(); ?>" width="700" height="880" loading="lazy">
<div class="show-copy"><p class="show-meta"><?php echo esc_html( trim( $year . ' · ' . $location, ' ·' ) ); ?></p><h3><?php the_title(); ?></h3><div><?php the_excerpt(); ?></div></div>
<div class="show-copy"><?php if ( $show_meta ) : ?><p class="show-meta"><?php echo esc_html( $show_meta ); ?></p><?php endif; ?><h3><?php the_title(); ?></h3><div><?php the_excerpt(); ?></div></div>
</article>
<?php
++$show_index;