Files
wp-fedistream/templates/partials/card-artist.php

48 lines
2.0 KiB
PHP
Raw Permalink Normal View History

<?php
/**
* Artist card partial template.
*
* @package WP_FediStream
*
* @var array $post Artist data array.
*/
// Prevent direct file access.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<article class="fedistream-card fedistream-card--artist">
<a href="<?php echo esc_url( $post['permalink'] ?? '' ); ?>" class="fedistream-card__link">
<div class="fedistream-card__image">
<?php if ( ! empty( $post['thumbnail'] ) ) : ?>
<img src="<?php echo esc_url( $post['thumbnail'] ); ?>" alt="<?php echo esc_attr( $post['title'] ?? '' ); ?>" loading="lazy">
<?php else : ?>
<div class="fedistream-card__placeholder fedistream-card__placeholder--artist">
<svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"/></svg>
</div>
<?php endif; ?>
</div>
<div class="fedistream-card__content">
<h3 class="fedistream-card__title"><?php echo esc_html( $post['title'] ?? '' ); ?></h3>
<p class="fedistream-card__meta">
<span class="fedistream-card__type"><?php echo esc_html( $post['artist_type_label'] ?? '' ); ?></span>
<?php if ( ! empty( $post['location'] ) ) : ?>
<span class="fedistream-card__location"><?php echo esc_html( $post['location'] ); ?></span>
<?php endif; ?>
</p>
<?php if ( isset( $post['album_count'] ) && $post['album_count'] > 0 ) : ?>
<p class="fedistream-card__stats">
<?php
printf(
/* translators: %d: number of albums */
esc_html( _n( '%d album', '%d albums', $post['album_count'], 'wp-fedistream' ) ),
(int) $post['album_count']
);
?>
</p>
<?php endif; ?>
</div>
</a>
</article>