You've already forked wp-fedistream
51 lines
2.3 KiB
PHP
51 lines
2.3 KiB
PHP
|
|
<?php
|
||
|
|
/**
|
||
|
|
* Album card partial template.
|
||
|
|
*
|
||
|
|
* @package WP_FediStream
|
||
|
|
*
|
||
|
|
* @var array $post Album data array.
|
||
|
|
*/
|
||
|
|
|
||
|
|
// Prevent direct file access.
|
||
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
||
|
|
exit;
|
||
|
|
}
|
||
|
|
?>
|
||
|
|
<article class="fedistream-card fedistream-card--album">
|
||
|
|
<a href="<?php echo esc_url( $post['permalink'] ?? '' ); ?>" class="fedistream-card__link">
|
||
|
|
<div class="fedistream-card__image fedistream-card__image--square">
|
||
|
|
<?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--album">
|
||
|
|
<svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 14.5c-2.49 0-4.5-2.01-4.5-4.5S9.51 7.5 12 7.5s4.5 2.01 4.5 4.5-2.01 4.5-4.5 4.5zm0-5.5c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1z"/></svg>
|
||
|
|
</div>
|
||
|
|
<?php endif; ?>
|
||
|
|
</div>
|
||
|
|
<div class="fedistream-card__content">
|
||
|
|
<h3 class="fedistream-card__title"><?php echo esc_html( $post['title'] ?? '' ); ?></h3>
|
||
|
|
<?php if ( ! empty( $post['artist_name'] ) ) : ?>
|
||
|
|
<p class="fedistream-card__artist"><?php echo esc_html( $post['artist_name'] ); ?></p>
|
||
|
|
<?php endif; ?>
|
||
|
|
<p class="fedistream-card__meta">
|
||
|
|
<span class="fedistream-card__type"><?php echo esc_html( $post['album_type_label'] ?? '' ); ?></span>
|
||
|
|
<?php if ( ! empty( $post['release_year'] ) ) : ?>
|
||
|
|
<span class="fedistream-card__year"><?php echo esc_html( $post['release_year'] ); ?></span>
|
||
|
|
<?php endif; ?>
|
||
|
|
</p>
|
||
|
|
<?php if ( ! empty( $post['total_tracks'] ) && $post['total_tracks'] > 0 ) : ?>
|
||
|
|
<p class="fedistream-card__stats">
|
||
|
|
<?php
|
||
|
|
printf(
|
||
|
|
/* translators: %d: number of tracks */
|
||
|
|
esc_html( _n( '%d track', '%d tracks', $post['total_tracks'], 'wp-fedistream' ) ),
|
||
|
|
(int) $post['total_tracks']
|
||
|
|
);
|
||
|
|
?>
|
||
|
|
</p>
|
||
|
|
<?php endif; ?>
|
||
|
|
</div>
|
||
|
|
</a>
|
||
|
|
</article>
|