You've already forked wp-fedistream
feat: Replace Twig with native PHP templates
All checks were successful
Create Release Package / build-release (push) Successful in 55s
All checks were successful
Create Release Package / build-release (push) Successful in 55s
- Remove twig/twig dependency from composer.json - Convert all 25 Twig templates to native PHP templates - New render() method in Plugin.php using PHP include with output buffering - New render_partial() helper method for including partials - Templates support theme overrides via fedistream/ directory - Reduced plugin size by eliminating Twig and its dependencies Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
126
templates/single/album.php
Normal file
126
templates/single/album.php
Normal file
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
/**
|
||||
* Single album template.
|
||||
*
|
||||
* @package WP_FediStream
|
||||
*
|
||||
* @var array $post Album data array.
|
||||
*/
|
||||
|
||||
// Prevent direct file access.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
<article class="fedistream-single fedistream-single--album">
|
||||
<header class="fedistream-single__header fedistream-single__header--album">
|
||||
<div class="fedistream-single__artwork">
|
||||
<?php if ( ! empty( $post['thumbnail'] ) ) : ?>
|
||||
<img src="<?php echo esc_url( $post['thumbnail'] ); ?>" alt="<?php echo esc_attr( $post['title'] ?? '' ); ?>" class="fedistream-single__image fedistream-single__image--album">
|
||||
<?php else : ?>
|
||||
<div class="fedistream-single__placeholder fedistream-single__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-single__info">
|
||||
<span class="fedistream-single__type-badge"><?php echo esc_html( $post['album_type_label'] ?? __( 'Album', 'wp-fedistream' ) ); ?></span>
|
||||
<h1 class="fedistream-single__title"><?php echo esc_html( $post['title'] ?? '' ); ?></h1>
|
||||
<?php if ( ! empty( $post['artist_name'] ) ) : ?>
|
||||
<p class="fedistream-single__artist">
|
||||
<a href="<?php echo esc_url( $post['artist_url'] ?? '#' ); ?>"><?php echo esc_html( $post['artist_name'] ); ?></a>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<div class="fedistream-single__meta">
|
||||
<?php if ( ! empty( $post['release_date'] ) ) : ?>
|
||||
<span class="fedistream-single__date"><?php echo esc_html( $post['release_date'] ); ?></span>
|
||||
<?php endif; ?>
|
||||
<?php if ( ! empty( $post['total_tracks'] ) ) : ?>
|
||||
<span class="fedistream-single__tracks">
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %d: number of tracks */
|
||||
esc_html( _n( '%d track', '%d tracks', $post['total_tracks'], 'wp-fedistream' ) ),
|
||||
(int) $post['total_tracks']
|
||||
);
|
||||
?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
<?php if ( ! empty( $post['duration_formatted'] ) ) : ?>
|
||||
<span class="fedistream-single__duration"><?php echo esc_html( $post['duration_formatted'] ); ?></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php if ( ! empty( $post['genres'] ) && is_array( $post['genres'] ) ) : ?>
|
||||
<div class="fedistream-single__genres">
|
||||
<?php foreach ( $post['genres'] as $genre ) : ?>
|
||||
<a href="<?php echo esc_url( $genre['url'] ?? '#' ); ?>" class="fedistream-tag"><?php echo esc_html( $genre['name'] ?? '' ); ?></a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="fedistream-single__actions">
|
||||
<button type="button" class="fedistream-btn fedistream-btn--primary fedistream-btn--play-all" data-album-id="<?php echo esc_attr( $post['id'] ?? '' ); ?>">
|
||||
<svg viewBox="0 0 24 24" fill="currentColor"><path d="M8 5v14l11-7z"/></svg>
|
||||
<?php esc_html_e( 'Play All', 'wp-fedistream' ); ?>
|
||||
</button>
|
||||
<button type="button" class="fedistream-btn fedistream-btn--secondary fedistream-btn--shuffle" data-album-id="<?php echo esc_attr( $post['id'] ?? '' ); ?>">
|
||||
<svg viewBox="0 0 24 24" fill="currentColor"><path d="M10.59 9.17L5.41 4 4 5.41l5.17 5.17 1.42-1.41zM14.5 4l2.04 2.04L4 18.59 5.41 20 17.96 7.46 20 9.5V4h-5.5zm.33 9.41l-1.41 1.41 3.13 3.13L14.5 20H20v-5.5l-2.04 2.04-3.13-3.13z"/></svg>
|
||||
<?php esc_html_e( 'Shuffle', 'wp-fedistream' ); ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<?php if ( ! empty( $post['tracks'] ) && is_array( $post['tracks'] ) ) : ?>
|
||||
<section class="fedistream-single__tracklist">
|
||||
<div class="fedistream-tracklist fedistream-tracklist--album">
|
||||
<?php foreach ( $post['tracks'] as $index => $track ) : ?>
|
||||
<div class="fedistream-tracklist__item" data-track-id="<?php echo esc_attr( $track['id'] ?? '' ); ?>">
|
||||
<span class="fedistream-tracklist__number"><?php echo esc_html( $track['track_number'] ?? ( $index + 1 ) ); ?></span>
|
||||
<div class="fedistream-tracklist__info">
|
||||
<a href="<?php echo esc_url( $track['permalink'] ?? '#' ); ?>" class="fedistream-tracklist__title"><?php echo esc_html( $track['title'] ?? '' ); ?></a>
|
||||
<?php if ( ! empty( $track['featured_artists'] ) ) : ?>
|
||||
<span class="fedistream-tracklist__featuring"><?php esc_html_e( 'feat.', 'wp-fedistream' ); ?> <?php echo esc_html( $track['featured_artists'] ); ?></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php if ( ! empty( $track['explicit'] ) ) : ?>
|
||||
<span class="fedistream-badge fedistream-badge--explicit">E</span>
|
||||
<?php endif; ?>
|
||||
<?php if ( ! empty( $track['duration_formatted'] ) ) : ?>
|
||||
<span class="fedistream-tracklist__duration"><?php echo esc_html( $track['duration_formatted'] ); ?></span>
|
||||
<?php endif; ?>
|
||||
<button type="button" class="fedistream-tracklist__play" aria-label="<?php esc_attr_e( 'Play', 'wp-fedistream' ); ?>">
|
||||
<svg viewBox="0 0 24 24" fill="currentColor"><path d="M8 5v14l11-7z"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( ! empty( $post['content'] ) ) : ?>
|
||||
<section class="fedistream-single__content">
|
||||
<h2 class="fedistream-section__title"><?php esc_html_e( 'About This Album', 'wp-fedistream' ); ?></h2>
|
||||
<div class="fedistream-single__description">
|
||||
<?php echo wp_kses_post( $post['content'] ); ?>
|
||||
</div>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( ! empty( $post['credits'] ) ) : ?>
|
||||
<section class="fedistream-single__credits">
|
||||
<h2 class="fedistream-section__title"><?php esc_html_e( 'Credits', 'wp-fedistream' ); ?></h2>
|
||||
<div class="fedistream-credits">
|
||||
<?php echo wp_kses_post( $post['credits'] ); ?>
|
||||
</div>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( ! empty( $post['license'] ) ) : ?>
|
||||
<section class="fedistream-single__license">
|
||||
<p class="fedistream-license">
|
||||
<strong><?php esc_html_e( 'License:', 'wp-fedistream' ); ?></strong>
|
||||
<a href="<?php echo esc_url( $post['license']['link'] ?? '#' ); ?>"><?php echo esc_html( $post['license']['name'] ?? '' ); ?></a>
|
||||
</p>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
</article>
|
||||
@@ -1,105 +0,0 @@
|
||||
{# Single album template #}
|
||||
<article class="fedistream-single fedistream-single--album">
|
||||
<header class="fedistream-single__header fedistream-single__header--album">
|
||||
<div class="fedistream-single__artwork">
|
||||
{% if post.thumbnail %}
|
||||
<img src="{{ post.thumbnail }}" alt="{{ post.title|e('html_attr') }}" class="fedistream-single__image fedistream-single__image--album">
|
||||
{% else %}
|
||||
<div class="fedistream-single__placeholder fedistream-single__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>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="fedistream-single__info">
|
||||
<span class="fedistream-single__type-badge">{{ post.album_type|default('Album') }}</span>
|
||||
<h1 class="fedistream-single__title">{{ post.title }}</h1>
|
||||
{% if post.artist %}
|
||||
<p class="fedistream-single__artist">
|
||||
<a href="{{ post.artist_link }}">{{ post.artist }}</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
<div class="fedistream-single__meta">
|
||||
{% if post.release_date %}
|
||||
<span class="fedistream-single__date">{{ post.release_date }}</span>
|
||||
{% endif %}
|
||||
{% if post.track_count %}
|
||||
<span class="fedistream-single__tracks">{{ post.track_count }} {{ post.track_count == 1 ? __('track', 'wp-fedistream') : __('tracks', 'wp-fedistream') }}</span>
|
||||
{% endif %}
|
||||
{% if post.duration_formatted %}
|
||||
<span class="fedistream-single__duration">{{ post.duration_formatted }}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if post.genres is not empty %}
|
||||
<div class="fedistream-single__genres">
|
||||
{% for genre in post.genres %}
|
||||
<a href="{{ genre.link }}" class="fedistream-tag">{{ genre.name }}</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="fedistream-single__actions">
|
||||
<button type="button" class="fedistream-btn fedistream-btn--primary fedistream-btn--play-all" data-album-id="{{ post.id }}">
|
||||
<svg viewBox="0 0 24 24" fill="currentColor"><path d="M8 5v14l11-7z"/></svg>
|
||||
{{ __('Play All', 'wp-fedistream') }}
|
||||
</button>
|
||||
<button type="button" class="fedistream-btn fedistream-btn--secondary fedistream-btn--shuffle" data-album-id="{{ post.id }}">
|
||||
<svg viewBox="0 0 24 24" fill="currentColor"><path d="M10.59 9.17L5.41 4 4 5.41l5.17 5.17 1.42-1.41zM14.5 4l2.04 2.04L4 18.59 5.41 20 17.96 7.46 20 9.5V4h-5.5zm.33 9.41l-1.41 1.41 3.13 3.13L14.5 20H20v-5.5l-2.04 2.04-3.13-3.13z"/></svg>
|
||||
{{ __('Shuffle', 'wp-fedistream') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
{% if post.tracks is not empty %}
|
||||
<section class="fedistream-single__tracklist">
|
||||
<div class="fedistream-tracklist fedistream-tracklist--album">
|
||||
{% for track in post.tracks %}
|
||||
<div class="fedistream-tracklist__item" data-track-id="{{ track.id }}">
|
||||
<span class="fedistream-tracklist__number">{{ track.track_number|default(loop.index) }}</span>
|
||||
<div class="fedistream-tracklist__info">
|
||||
<a href="{{ track.permalink }}" class="fedistream-tracklist__title">{{ track.title }}</a>
|
||||
{% if track.featured_artists %}
|
||||
<span class="fedistream-tracklist__featuring">{{ __('feat.', 'wp-fedistream') }} {{ track.featured_artists }}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if track.explicit %}
|
||||
<span class="fedistream-badge fedistream-badge--explicit">E</span>
|
||||
{% endif %}
|
||||
{% if track.duration_formatted %}
|
||||
<span class="fedistream-tracklist__duration">{{ track.duration_formatted }}</span>
|
||||
{% endif %}
|
||||
<button type="button" class="fedistream-tracklist__play" aria-label="{{ __('Play', 'wp-fedistream') }}">
|
||||
<svg viewBox="0 0 24 24" fill="currentColor"><path d="M8 5v14l11-7z"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</section>
|
||||
{% endif %}
|
||||
|
||||
{% if post.content %}
|
||||
<section class="fedistream-single__content">
|
||||
<h2 class="fedistream-section__title">{{ __('About This Album', 'wp-fedistream') }}</h2>
|
||||
<div class="fedistream-single__description">
|
||||
{{ post.content|raw }}
|
||||
</div>
|
||||
</section>
|
||||
{% endif %}
|
||||
|
||||
{% if post.credits %}
|
||||
<section class="fedistream-single__credits">
|
||||
<h2 class="fedistream-section__title">{{ __('Credits', 'wp-fedistream') }}</h2>
|
||||
<div class="fedistream-credits">
|
||||
{{ post.credits|raw }}
|
||||
</div>
|
||||
</section>
|
||||
{% endif %}
|
||||
|
||||
{% if post.license %}
|
||||
<section class="fedistream-single__license">
|
||||
<p class="fedistream-license">
|
||||
<strong>{{ __('License:', 'wp-fedistream') }}</strong>
|
||||
<a href="{{ post.license.link }}">{{ post.license.name }}</a>
|
||||
</p>
|
||||
</section>
|
||||
{% endif %}
|
||||
</article>
|
||||
103
templates/single/artist.php
Normal file
103
templates/single/artist.php
Normal file
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
/**
|
||||
* Single artist template.
|
||||
*
|
||||
* @package WP_FediStream
|
||||
*
|
||||
* @var array $post Artist data array.
|
||||
*/
|
||||
|
||||
// Prevent direct file access.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$plugin = \WP_FediStream\Plugin::get_instance();
|
||||
?>
|
||||
<article class="fedistream-single fedistream-single--artist">
|
||||
<header class="fedistream-single__header">
|
||||
<div class="fedistream-single__hero">
|
||||
<?php if ( ! empty( $post['thumbnail'] ) ) : ?>
|
||||
<img src="<?php echo esc_url( $post['thumbnail'] ); ?>" alt="<?php echo esc_attr( $post['title'] ?? '' ); ?>" class="fedistream-single__image fedistream-single__image--artist">
|
||||
<?php else : ?>
|
||||
<div class="fedistream-single__placeholder fedistream-single__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-single__info">
|
||||
<h1 class="fedistream-single__title"><?php echo esc_html( $post['title'] ?? '' ); ?></h1>
|
||||
<?php if ( ! empty( $post['artist_type_label'] ) ) : ?>
|
||||
<p class="fedistream-single__type"><?php echo esc_html( $post['artist_type_label'] ); ?></p>
|
||||
<?php endif; ?>
|
||||
<?php if ( ! empty( $post['genres'] ) && is_array( $post['genres'] ) ) : ?>
|
||||
<div class="fedistream-single__genres">
|
||||
<?php foreach ( $post['genres'] as $genre ) : ?>
|
||||
<a href="<?php echo esc_url( $genre['url'] ?? '#' ); ?>" class="fedistream-tag"><?php echo esc_html( $genre['name'] ?? '' ); ?></a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<?php if ( ! empty( $post['content'] ) ) : ?>
|
||||
<section class="fedistream-single__content">
|
||||
<h2 class="fedistream-section__title"><?php esc_html_e( 'About', 'wp-fedistream' ); ?></h2>
|
||||
<div class="fedistream-single__description">
|
||||
<?php echo wp_kses_post( $post['content'] ); ?>
|
||||
</div>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( ! empty( $post['social_links'] ) && is_array( $post['social_links'] ) ) : ?>
|
||||
<section class="fedistream-single__social">
|
||||
<h2 class="fedistream-section__title"><?php esc_html_e( 'Connect', 'wp-fedistream' ); ?></h2>
|
||||
<div class="fedistream-social-links">
|
||||
<?php foreach ( $post['social_links'] as $platform => $url ) : ?>
|
||||
<a href="<?php echo esc_url( $url ); ?>" class="fedistream-social-link fedistream-social-link--<?php echo esc_attr( $platform ); ?>" target="_blank" rel="noopener noreferrer">
|
||||
<?php echo esc_html( $platform ); ?>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( ! empty( $post['albums'] ) && is_array( $post['albums'] ) ) : ?>
|
||||
<section class="fedistream-single__albums">
|
||||
<h2 class="fedistream-section__title"><?php esc_html_e( 'Discography', 'wp-fedistream' ); ?></h2>
|
||||
<div class="fedistream-grid fedistream-grid--albums">
|
||||
<?php foreach ( $post['albums'] as $album ) : ?>
|
||||
<?php echo $plugin->render_partial( 'partials/card-album', array( 'post' => $album ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( ! empty( $post['tracks'] ) && is_array( $post['tracks'] ) ) : ?>
|
||||
<section class="fedistream-single__tracks">
|
||||
<h2 class="fedistream-section__title"><?php esc_html_e( 'Popular Tracks', 'wp-fedistream' ); ?></h2>
|
||||
<div class="fedistream-tracklist">
|
||||
<?php foreach ( $post['tracks'] as $index => $track ) : ?>
|
||||
<div class="fedistream-tracklist__item" data-track-id="<?php echo esc_attr( $track['id'] ?? '' ); ?>">
|
||||
<span class="fedistream-tracklist__number"><?php echo esc_html( $index + 1 ); ?></span>
|
||||
<?php if ( ! empty( $track['thumbnail'] ) ) : ?>
|
||||
<img src="<?php echo esc_url( $track['thumbnail'] ); ?>" alt="" class="fedistream-tracklist__artwork">
|
||||
<?php endif; ?>
|
||||
<div class="fedistream-tracklist__info">
|
||||
<a href="<?php echo esc_url( $track['permalink'] ?? '#' ); ?>" class="fedistream-tracklist__title"><?php echo esc_html( $track['title'] ?? '' ); ?></a>
|
||||
<?php if ( ! empty( $track['album_title'] ) ) : ?>
|
||||
<span class="fedistream-tracklist__album"><?php echo esc_html( $track['album_title'] ); ?></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php if ( ! empty( $track['duration_formatted'] ) ) : ?>
|
||||
<span class="fedistream-tracklist__duration"><?php echo esc_html( $track['duration_formatted'] ); ?></span>
|
||||
<?php endif; ?>
|
||||
<button type="button" class="fedistream-tracklist__play" aria-label="<?php esc_attr_e( 'Play', 'wp-fedistream' ); ?>">
|
||||
<svg viewBox="0 0 24 24" fill="currentColor"><path d="M8 5v14l11-7z"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
</article>
|
||||
@@ -1,88 +0,0 @@
|
||||
{# Single artist template #}
|
||||
<article class="fedistream-single fedistream-single--artist">
|
||||
<header class="fedistream-single__header">
|
||||
<div class="fedistream-single__hero">
|
||||
{% if post.thumbnail %}
|
||||
<img src="{{ post.thumbnail }}" alt="{{ post.title|e('html_attr') }}" class="fedistream-single__image fedistream-single__image--artist">
|
||||
{% else %}
|
||||
<div class="fedistream-single__placeholder fedistream-single__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>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="fedistream-single__info">
|
||||
<h1 class="fedistream-single__title">{{ post.title }}</h1>
|
||||
{% if post.artist_type %}
|
||||
<p class="fedistream-single__type">{{ post.artist_type }}</p>
|
||||
{% endif %}
|
||||
{% if post.genres is not empty %}
|
||||
<div class="fedistream-single__genres">
|
||||
{% for genre in post.genres %}
|
||||
<a href="{{ genre.link }}" class="fedistream-tag">{{ genre.name }}</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</header>
|
||||
|
||||
{% if post.content %}
|
||||
<section class="fedistream-single__content">
|
||||
<h2 class="fedistream-section__title">{{ __('About', 'wp-fedistream') }}</h2>
|
||||
<div class="fedistream-single__description">
|
||||
{{ post.content|raw }}
|
||||
</div>
|
||||
</section>
|
||||
{% endif %}
|
||||
|
||||
{% if post.social_links is not empty %}
|
||||
<section class="fedistream-single__social">
|
||||
<h2 class="fedistream-section__title">{{ __('Connect', 'wp-fedistream') }}</h2>
|
||||
<div class="fedistream-social-links">
|
||||
{% for platform, url in post.social_links %}
|
||||
<a href="{{ url }}" class="fedistream-social-link fedistream-social-link--{{ platform }}" target="_blank" rel="noopener noreferrer">
|
||||
{{ platform }}
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</section>
|
||||
{% endif %}
|
||||
|
||||
{% if post.albums is not empty %}
|
||||
<section class="fedistream-single__albums">
|
||||
<h2 class="fedistream-section__title">{{ __('Discography', 'wp-fedistream') }}</h2>
|
||||
<div class="fedistream-grid fedistream-grid--albums">
|
||||
{% for album in post.albums %}
|
||||
{% include 'partials/card-album.twig' with { post: album } %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</section>
|
||||
{% endif %}
|
||||
|
||||
{% if post.tracks is not empty %}
|
||||
<section class="fedistream-single__tracks">
|
||||
<h2 class="fedistream-section__title">{{ __('Popular Tracks', 'wp-fedistream') }}</h2>
|
||||
<div class="fedistream-tracklist">
|
||||
{% for track in post.tracks %}
|
||||
<div class="fedistream-tracklist__item" data-track-id="{{ track.id }}">
|
||||
<span class="fedistream-tracklist__number">{{ loop.index }}</span>
|
||||
{% if track.thumbnail %}
|
||||
<img src="{{ track.thumbnail }}" alt="" class="fedistream-tracklist__artwork">
|
||||
{% endif %}
|
||||
<div class="fedistream-tracklist__info">
|
||||
<a href="{{ track.permalink }}" class="fedistream-tracklist__title">{{ track.title }}</a>
|
||||
{% if track.album %}
|
||||
<span class="fedistream-tracklist__album">{{ track.album }}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if track.duration_formatted %}
|
||||
<span class="fedistream-tracklist__duration">{{ track.duration_formatted }}</span>
|
||||
{% endif %}
|
||||
<button type="button" class="fedistream-tracklist__play" aria-label="{{ __('Play', 'wp-fedistream') }}">
|
||||
<svg viewBox="0 0 24 24" fill="currentColor"><path d="M8 5v14l11-7z"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</section>
|
||||
{% endif %}
|
||||
</article>
|
||||
136
templates/single/playlist.php
Normal file
136
templates/single/playlist.php
Normal file
@@ -0,0 +1,136 @@
|
||||
<?php
|
||||
/**
|
||||
* Single playlist template.
|
||||
*
|
||||
* @package WP_FediStream
|
||||
*
|
||||
* @var array $post Playlist data array.
|
||||
*/
|
||||
|
||||
// Prevent direct file access.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
<article class="fedistream-single fedistream-single--playlist">
|
||||
<header class="fedistream-single__header fedistream-single__header--playlist">
|
||||
<div class="fedistream-single__artwork">
|
||||
<?php if ( ! empty( $post['thumbnail'] ) ) : ?>
|
||||
<img src="<?php echo esc_url( $post['thumbnail'] ); ?>" alt="<?php echo esc_attr( $post['title'] ?? '' ); ?>" class="fedistream-single__image fedistream-single__image--playlist">
|
||||
<?php else : ?>
|
||||
<div class="fedistream-single__placeholder fedistream-single__placeholder--playlist">
|
||||
<svg viewBox="0 0 24 24" fill="currentColor"><path d="M15 6H3v2h12V6zm0 4H3v2h12v-2zM3 16h8v-2H3v2zM17 6v8.18c-.31-.11-.65-.18-1-.18-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3V8h3V6h-5z"/></svg>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ( isset( $post['visibility'] ) && 'private' === $post['visibility'] ) : ?>
|
||||
<span class="fedistream-single__badge fedistream-single__badge--private">
|
||||
<svg viewBox="0 0 24 24" fill="currentColor" width="16" height="16"><path d="M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zM9 6c0-1.66 1.34-3 3-3s3 1.34 3 3v2H9V6zm9 14H6V10h12v10zm-6-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2z"/></svg>
|
||||
<?php esc_html_e( 'Private', 'wp-fedistream' ); ?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="fedistream-single__info">
|
||||
<span class="fedistream-single__type-badge"><?php esc_html_e( 'Playlist', 'wp-fedistream' ); ?></span>
|
||||
<h1 class="fedistream-single__title"><?php echo esc_html( $post['title'] ?? '' ); ?></h1>
|
||||
<?php if ( ! empty( $post['author'] ) ) : ?>
|
||||
<p class="fedistream-single__author">
|
||||
<?php esc_html_e( 'Created by', 'wp-fedistream' ); ?> <a href="<?php echo esc_url( $post['author_link'] ?? '#' ); ?>"><?php echo esc_html( $post['author'] ); ?></a>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<div class="fedistream-single__meta">
|
||||
<?php if ( ! empty( $post['track_count'] ) ) : ?>
|
||||
<span class="fedistream-single__tracks">
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %d: number of tracks */
|
||||
esc_html( _n( '%d track', '%d tracks', $post['track_count'], 'wp-fedistream' ) ),
|
||||
(int) $post['track_count']
|
||||
);
|
||||
?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
<?php if ( ! empty( $post['duration_formatted'] ) ) : ?>
|
||||
<span class="fedistream-single__duration"><?php echo esc_html( $post['duration_formatted'] ); ?></span>
|
||||
<?php endif; ?>
|
||||
<?php if ( ! empty( $post['updated_date'] ) ) : ?>
|
||||
<span class="fedistream-single__updated"><?php esc_html_e( 'Updated', 'wp-fedistream' ); ?> <?php echo esc_html( $post['updated_date'] ); ?></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php if ( ! empty( $post['moods'] ) && is_array( $post['moods'] ) ) : ?>
|
||||
<div class="fedistream-single__moods">
|
||||
<?php foreach ( $post['moods'] as $mood ) : ?>
|
||||
<a href="<?php echo esc_url( $mood['url'] ?? '#' ); ?>" class="fedistream-tag fedistream-tag--mood"><?php echo esc_html( $mood['name'] ?? '' ); ?></a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="fedistream-single__actions">
|
||||
<button type="button" class="fedistream-btn fedistream-btn--primary fedistream-btn--play-all" data-playlist-id="<?php echo esc_attr( $post['id'] ?? '' ); ?>">
|
||||
<svg viewBox="0 0 24 24" fill="currentColor"><path d="M8 5v14l11-7z"/></svg>
|
||||
<?php esc_html_e( 'Play All', 'wp-fedistream' ); ?>
|
||||
</button>
|
||||
<button type="button" class="fedistream-btn fedistream-btn--secondary fedistream-btn--shuffle" data-playlist-id="<?php echo esc_attr( $post['id'] ?? '' ); ?>">
|
||||
<svg viewBox="0 0 24 24" fill="currentColor"><path d="M10.59 9.17L5.41 4 4 5.41l5.17 5.17 1.42-1.41zM14.5 4l2.04 2.04L4 18.59 5.41 20 17.96 7.46 20 9.5V4h-5.5zm.33 9.41l-1.41 1.41 3.13 3.13L14.5 20H20v-5.5l-2.04 2.04-3.13-3.13z"/></svg>
|
||||
<?php esc_html_e( 'Shuffle', 'wp-fedistream' ); ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<?php if ( ! empty( $post['content'] ) ) : ?>
|
||||
<section class="fedistream-single__content">
|
||||
<div class="fedistream-single__description">
|
||||
<?php echo wp_kses_post( $post['content'] ); ?>
|
||||
</div>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( ! empty( $post['tracks'] ) && is_array( $post['tracks'] ) ) : ?>
|
||||
<section class="fedistream-single__tracklist">
|
||||
<div class="fedistream-tracklist fedistream-tracklist--playlist">
|
||||
<?php foreach ( $post['tracks'] as $index => $track ) : ?>
|
||||
<div class="fedistream-tracklist__item" data-track-id="<?php echo esc_attr( $track['id'] ?? '' ); ?>">
|
||||
<span class="fedistream-tracklist__number"><?php echo esc_html( $index + 1 ); ?></span>
|
||||
<?php if ( ! empty( $track['thumbnail'] ) ) : ?>
|
||||
<img src="<?php echo esc_url( $track['thumbnail'] ); ?>" alt="" class="fedistream-tracklist__artwork">
|
||||
<?php endif; ?>
|
||||
<div class="fedistream-tracklist__info">
|
||||
<a href="<?php echo esc_url( $track['permalink'] ?? '#' ); ?>" class="fedistream-tracklist__title"><?php echo esc_html( $track['title'] ?? '' ); ?></a>
|
||||
<span class="fedistream-tracklist__artist">
|
||||
<?php if ( ! empty( $track['artists'] ) && is_array( $track['artists'] ) ) : ?>
|
||||
<?php
|
||||
$artist_links = array();
|
||||
foreach ( $track['artists'] as $artist ) {
|
||||
$artist_links[] = sprintf(
|
||||
'<a href="%s">%s</a>',
|
||||
esc_url( $artist['url'] ?? '#' ),
|
||||
esc_html( $artist['name'] ?? '' )
|
||||
);
|
||||
}
|
||||
echo implode( ', ', $artist_links ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
?>
|
||||
<?php elseif ( ! empty( $track['artist'] ) ) : ?>
|
||||
<?php echo esc_html( $track['artist'] ); ?>
|
||||
<?php endif; ?>
|
||||
</span>
|
||||
</div>
|
||||
<?php if ( ! empty( $track['explicit'] ) ) : ?>
|
||||
<span class="fedistream-badge fedistream-badge--explicit">E</span>
|
||||
<?php endif; ?>
|
||||
<?php if ( ! empty( $track['duration_formatted'] ) ) : ?>
|
||||
<span class="fedistream-tracklist__duration"><?php echo esc_html( $track['duration_formatted'] ); ?></span>
|
||||
<?php endif; ?>
|
||||
<button type="button" class="fedistream-tracklist__play" aria-label="<?php esc_attr_e( 'Play', 'wp-fedistream' ); ?>">
|
||||
<svg viewBox="0 0 24 24" fill="currentColor"><path d="M8 5v14l11-7z"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</section>
|
||||
<?php else : ?>
|
||||
<section class="fedistream-single__empty">
|
||||
<div class="fedistream-empty">
|
||||
<p><?php esc_html_e( 'This playlist is empty.', 'wp-fedistream' ); ?></p>
|
||||
</div>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
</article>
|
||||
@@ -1,107 +0,0 @@
|
||||
{# Single playlist template #}
|
||||
<article class="fedistream-single fedistream-single--playlist">
|
||||
<header class="fedistream-single__header fedistream-single__header--playlist">
|
||||
<div class="fedistream-single__artwork">
|
||||
{% if post.thumbnail %}
|
||||
<img src="{{ post.thumbnail }}" alt="{{ post.title|e('html_attr') }}" class="fedistream-single__image fedistream-single__image--playlist">
|
||||
{% else %}
|
||||
<div class="fedistream-single__placeholder fedistream-single__placeholder--playlist">
|
||||
<svg viewBox="0 0 24 24" fill="currentColor"><path d="M15 6H3v2h12V6zm0 4H3v2h12v-2zM3 16h8v-2H3v2zM17 6v8.18c-.31-.11-.65-.18-1-.18-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3V8h3V6h-5z"/></svg>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if post.visibility == 'private' %}
|
||||
<span class="fedistream-single__badge fedistream-single__badge--private">
|
||||
<svg viewBox="0 0 24 24" fill="currentColor" width="16" height="16"><path d="M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zM9 6c0-1.66 1.34-3 3-3s3 1.34 3 3v2H9V6zm9 14H6V10h12v10zm-6-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2z"/></svg>
|
||||
{{ __('Private', 'wp-fedistream') }}
|
||||
</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="fedistream-single__info">
|
||||
<span class="fedistream-single__type-badge">{{ __('Playlist', 'wp-fedistream') }}</span>
|
||||
<h1 class="fedistream-single__title">{{ post.title }}</h1>
|
||||
{% if post.author %}
|
||||
<p class="fedistream-single__author">
|
||||
{{ __('Created by', 'wp-fedistream') }} <a href="{{ post.author_link }}">{{ post.author }}</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
<div class="fedistream-single__meta">
|
||||
{% if post.track_count %}
|
||||
<span class="fedistream-single__tracks">{{ post.track_count }} {{ post.track_count == 1 ? __('track', 'wp-fedistream') : __('tracks', 'wp-fedistream') }}</span>
|
||||
{% endif %}
|
||||
{% if post.duration_formatted %}
|
||||
<span class="fedistream-single__duration">{{ post.duration_formatted }}</span>
|
||||
{% endif %}
|
||||
{% if post.updated_date %}
|
||||
<span class="fedistream-single__updated">{{ __('Updated', 'wp-fedistream') }} {{ post.updated_date }}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if post.moods is not empty %}
|
||||
<div class="fedistream-single__moods">
|
||||
{% for mood in post.moods %}
|
||||
<a href="{{ mood.link }}" class="fedistream-tag fedistream-tag--mood">{{ mood.name }}</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="fedistream-single__actions">
|
||||
<button type="button" class="fedistream-btn fedistream-btn--primary fedistream-btn--play-all" data-playlist-id="{{ post.id }}">
|
||||
<svg viewBox="0 0 24 24" fill="currentColor"><path d="M8 5v14l11-7z"/></svg>
|
||||
{{ __('Play All', 'wp-fedistream') }}
|
||||
</button>
|
||||
<button type="button" class="fedistream-btn fedistream-btn--secondary fedistream-btn--shuffle" data-playlist-id="{{ post.id }}">
|
||||
<svg viewBox="0 0 24 24" fill="currentColor"><path d="M10.59 9.17L5.41 4 4 5.41l5.17 5.17 1.42-1.41zM14.5 4l2.04 2.04L4 18.59 5.41 20 17.96 7.46 20 9.5V4h-5.5zm.33 9.41l-1.41 1.41 3.13 3.13L14.5 20H20v-5.5l-2.04 2.04-3.13-3.13z"/></svg>
|
||||
{{ __('Shuffle', 'wp-fedistream') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
{% if post.content %}
|
||||
<section class="fedistream-single__content">
|
||||
<div class="fedistream-single__description">
|
||||
{{ post.content|raw }}
|
||||
</div>
|
||||
</section>
|
||||
{% endif %}
|
||||
|
||||
{% if post.tracks is not empty %}
|
||||
<section class="fedistream-single__tracklist">
|
||||
<div class="fedistream-tracklist fedistream-tracklist--playlist">
|
||||
{% for track in post.tracks %}
|
||||
<div class="fedistream-tracklist__item" data-track-id="{{ track.id }}">
|
||||
<span class="fedistream-tracklist__number">{{ loop.index }}</span>
|
||||
{% if track.thumbnail %}
|
||||
<img src="{{ track.thumbnail }}" alt="" class="fedistream-tracklist__artwork">
|
||||
{% endif %}
|
||||
<div class="fedistream-tracklist__info">
|
||||
<a href="{{ track.permalink }}" class="fedistream-tracklist__title">{{ track.title }}</a>
|
||||
<span class="fedistream-tracklist__artist">
|
||||
{% if track.artists is iterable %}
|
||||
{% for artist in track.artists %}
|
||||
<a href="{{ artist.link }}">{{ artist.name }}</a>{% if not loop.last %}, {% endif %}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
{{ track.artist }}
|
||||
{% endif %}
|
||||
</span>
|
||||
</div>
|
||||
{% if track.explicit %}
|
||||
<span class="fedistream-badge fedistream-badge--explicit">E</span>
|
||||
{% endif %}
|
||||
{% if track.duration_formatted %}
|
||||
<span class="fedistream-tracklist__duration">{{ track.duration_formatted }}</span>
|
||||
{% endif %}
|
||||
<button type="button" class="fedistream-tracklist__play" aria-label="{{ __('Play', 'wp-fedistream') }}">
|
||||
<svg viewBox="0 0 24 24" fill="currentColor"><path d="M8 5v14l11-7z"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</section>
|
||||
{% else %}
|
||||
<section class="fedistream-single__empty">
|
||||
<div class="fedistream-empty">
|
||||
<p>{{ __('This playlist is empty.', 'wp-fedistream') }}</p>
|
||||
</div>
|
||||
</section>
|
||||
{% endif %}
|
||||
</article>
|
||||
149
templates/single/track.php
Normal file
149
templates/single/track.php
Normal file
@@ -0,0 +1,149 @@
|
||||
<?php
|
||||
/**
|
||||
* Single track template.
|
||||
*
|
||||
* @package WP_FediStream
|
||||
*
|
||||
* @var array $post Track data array.
|
||||
*/
|
||||
|
||||
// Prevent direct file access.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
<article class="fedistream-single fedistream-single--track">
|
||||
<header class="fedistream-single__header fedistream-single__header--track">
|
||||
<div class="fedistream-single__artwork">
|
||||
<?php if ( ! empty( $post['thumbnail'] ) ) : ?>
|
||||
<img src="<?php echo esc_url( $post['thumbnail'] ); ?>" alt="<?php echo esc_attr( $post['title'] ?? '' ); ?>" class="fedistream-single__image fedistream-single__image--track">
|
||||
<?php else : ?>
|
||||
<div class="fedistream-single__placeholder fedistream-single__placeholder--track">
|
||||
<svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 3v10.55c-.59-.34-1.27-.55-2-.55-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4V7h4V3h-6z"/></svg>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<button type="button" class="fedistream-single__play-overlay" data-track-id="<?php echo esc_attr( $post['id'] ?? '' ); ?>" aria-label="<?php esc_attr_e( 'Play', 'wp-fedistream' ); ?>">
|
||||
<svg viewBox="0 0 24 24" fill="currentColor"><path d="M8 5v14l11-7z"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
<div class="fedistream-single__info">
|
||||
<h1 class="fedistream-single__title"><?php echo esc_html( $post['title'] ?? '' ); ?></h1>
|
||||
<?php if ( ! empty( $post['artists'] ) && is_array( $post['artists'] ) ) : ?>
|
||||
<p class="fedistream-single__artists">
|
||||
<?php
|
||||
$artist_links = array();
|
||||
foreach ( $post['artists'] as $artist ) {
|
||||
$artist_links[] = sprintf(
|
||||
'<a href="%s">%s</a>',
|
||||
esc_url( $artist['url'] ?? '#' ),
|
||||
esc_html( $artist['name'] ?? '' )
|
||||
);
|
||||
}
|
||||
echo implode( ', ', $artist_links ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<?php if ( ! empty( $post['album_title'] ) ) : ?>
|
||||
<p class="fedistream-single__album">
|
||||
<?php esc_html_e( 'From', 'wp-fedistream' ); ?> <a href="<?php echo esc_url( $post['album_url'] ?? '#' ); ?>"><?php echo esc_html( $post['album_title'] ); ?></a>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<div class="fedistream-single__meta">
|
||||
<?php if ( ! empty( $post['duration_formatted'] ) ) : ?>
|
||||
<span class="fedistream-single__duration"><?php echo esc_html( $post['duration_formatted'] ); ?></span>
|
||||
<?php endif; ?>
|
||||
<?php if ( ! empty( $post['play_count'] ) ) : ?>
|
||||
<span class="fedistream-single__plays">
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %d: number of plays */
|
||||
esc_html( _n( '%d play', '%d plays', $post['play_count'], 'wp-fedistream' ) ),
|
||||
(int) $post['play_count']
|
||||
);
|
||||
?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
<?php if ( ! empty( $post['explicit'] ) ) : ?>
|
||||
<span class="fedistream-badge fedistream-badge--explicit"><?php esc_html_e( 'Explicit', 'wp-fedistream' ); ?></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php if ( ! empty( $post['genres'] ) && is_array( $post['genres'] ) ) : ?>
|
||||
<div class="fedistream-single__genres">
|
||||
<?php foreach ( $post['genres'] as $genre ) : ?>
|
||||
<a href="<?php echo esc_url( $genre['url'] ?? '#' ); ?>" class="fedistream-tag"><?php echo esc_html( $genre['name'] ?? '' ); ?></a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ( ! empty( $post['moods'] ) && is_array( $post['moods'] ) ) : ?>
|
||||
<div class="fedistream-single__moods">
|
||||
<?php foreach ( $post['moods'] as $mood ) : ?>
|
||||
<a href="<?php echo esc_url( $mood['url'] ?? '#' ); ?>" class="fedistream-tag fedistream-tag--mood"><?php echo esc_html( $mood['name'] ?? '' ); ?></a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<?php if ( ! empty( $post['audio_url'] ) ) : ?>
|
||||
<section class="fedistream-single__player">
|
||||
<div class="fedistream-player" data-track-id="<?php echo esc_attr( $post['id'] ?? '' ); ?>" data-audio-url="<?php echo esc_url( $post['audio_url'] ); ?>">
|
||||
<div class="fedistream-player__controls">
|
||||
<button type="button" class="fedistream-player__btn fedistream-player__btn--play" aria-label="<?php esc_attr_e( 'Play', 'wp-fedistream' ); ?>">
|
||||
<svg class="fedistream-player__icon fedistream-player__icon--play" viewBox="0 0 24 24" fill="currentColor"><path d="M8 5v14l11-7z"/></svg>
|
||||
<svg class="fedistream-player__icon fedistream-player__icon--pause" viewBox="0 0 24 24" fill="currentColor"><path d="M6 19h4V5H6v14zm8-14v14h4V5h-4z"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
<div class="fedistream-player__progress">
|
||||
<span class="fedistream-player__time fedistream-player__time--current">0:00</span>
|
||||
<div class="fedistream-player__bar">
|
||||
<div class="fedistream-player__bar-progress"></div>
|
||||
<input type="range" class="fedistream-player__seek" min="0" max="100" value="0" aria-label="<?php esc_attr_e( 'Seek', 'wp-fedistream' ); ?>">
|
||||
</div>
|
||||
<span class="fedistream-player__time fedistream-player__time--total"><?php echo esc_html( $post['duration_formatted'] ?? '0:00' ); ?></span>
|
||||
</div>
|
||||
<div class="fedistream-player__volume">
|
||||
<button type="button" class="fedistream-player__btn fedistream-player__btn--volume" aria-label="<?php esc_attr_e( 'Volume', 'wp-fedistream' ); ?>">
|
||||
<svg viewBox="0 0 24 24" fill="currentColor"><path d="M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z"/></svg>
|
||||
</button>
|
||||
<input type="range" class="fedistream-player__volume-slider" min="0" max="100" value="80" aria-label="<?php esc_attr_e( 'Volume', 'wp-fedistream' ); ?>">
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( ! empty( $post['content'] ) ) : ?>
|
||||
<section class="fedistream-single__content">
|
||||
<h2 class="fedistream-section__title"><?php esc_html_e( 'About This Track', 'wp-fedistream' ); ?></h2>
|
||||
<div class="fedistream-single__description">
|
||||
<?php echo wp_kses_post( $post['content'] ); ?>
|
||||
</div>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( ! empty( $post['lyrics'] ) ) : ?>
|
||||
<section class="fedistream-single__lyrics">
|
||||
<h2 class="fedistream-section__title"><?php esc_html_e( 'Lyrics', 'wp-fedistream' ); ?></h2>
|
||||
<div class="fedistream-lyrics">
|
||||
<?php echo nl2br( esc_html( $post['lyrics'] ) ); ?>
|
||||
</div>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( ! empty( $post['credits'] ) ) : ?>
|
||||
<section class="fedistream-single__credits">
|
||||
<h2 class="fedistream-section__title"><?php esc_html_e( 'Credits', 'wp-fedistream' ); ?></h2>
|
||||
<div class="fedistream-credits">
|
||||
<?php echo wp_kses_post( $post['credits'] ); ?>
|
||||
</div>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( ! empty( $post['license'] ) ) : ?>
|
||||
<section class="fedistream-single__license">
|
||||
<p class="fedistream-license">
|
||||
<strong><?php esc_html_e( 'License:', 'wp-fedistream' ); ?></strong>
|
||||
<a href="<?php echo esc_url( $post['license']['link'] ?? '#' ); ?>"><?php echo esc_html( $post['license']['name'] ?? '' ); ?></a>
|
||||
</p>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
</article>
|
||||
@@ -1,120 +0,0 @@
|
||||
{# Single track template #}
|
||||
<article class="fedistream-single fedistream-single--track">
|
||||
<header class="fedistream-single__header fedistream-single__header--track">
|
||||
<div class="fedistream-single__artwork">
|
||||
{% if post.thumbnail %}
|
||||
<img src="{{ post.thumbnail }}" alt="{{ post.title|e('html_attr') }}" class="fedistream-single__image fedistream-single__image--track">
|
||||
{% else %}
|
||||
<div class="fedistream-single__placeholder fedistream-single__placeholder--track">
|
||||
<svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 3v10.55c-.59-.34-1.27-.55-2-.55-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4V7h4V3h-6z"/></svg>
|
||||
</div>
|
||||
{% endif %}
|
||||
<button type="button" class="fedistream-single__play-overlay" data-track-id="{{ post.id }}" aria-label="{{ __('Play', 'wp-fedistream') }}">
|
||||
<svg viewBox="0 0 24 24" fill="currentColor"><path d="M8 5v14l11-7z"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
<div class="fedistream-single__info">
|
||||
<h1 class="fedistream-single__title">{{ post.title }}</h1>
|
||||
{% if post.artists is not empty %}
|
||||
<p class="fedistream-single__artists">
|
||||
{% for artist in post.artists %}
|
||||
<a href="{{ artist.link }}">{{ artist.name }}</a>{% if not loop.last %}, {% endif %}
|
||||
{% endfor %}
|
||||
</p>
|
||||
{% endif %}
|
||||
{% if post.album %}
|
||||
<p class="fedistream-single__album">
|
||||
{{ __('From', 'wp-fedistream') }} <a href="{{ post.album_link }}">{{ post.album }}</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
<div class="fedistream-single__meta">
|
||||
{% if post.duration_formatted %}
|
||||
<span class="fedistream-single__duration">{{ post.duration_formatted }}</span>
|
||||
{% endif %}
|
||||
{% if post.play_count %}
|
||||
<span class="fedistream-single__plays">{{ post.play_count }} {{ post.play_count == 1 ? __('play', 'wp-fedistream') : __('plays', 'wp-fedistream') }}</span>
|
||||
{% endif %}
|
||||
{% if post.explicit %}
|
||||
<span class="fedistream-badge fedistream-badge--explicit">{{ __('Explicit', 'wp-fedistream') }}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if post.genres is not empty %}
|
||||
<div class="fedistream-single__genres">
|
||||
{% for genre in post.genres %}
|
||||
<a href="{{ genre.link }}" class="fedistream-tag">{{ genre.name }}</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if post.moods is not empty %}
|
||||
<div class="fedistream-single__moods">
|
||||
{% for mood in post.moods %}
|
||||
<a href="{{ mood.link }}" class="fedistream-tag fedistream-tag--mood">{{ mood.name }}</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</header>
|
||||
|
||||
{% if post.audio_url %}
|
||||
<section class="fedistream-single__player">
|
||||
<div class="fedistream-player" data-track-id="{{ post.id }}" data-audio-url="{{ post.audio_url }}">
|
||||
<div class="fedistream-player__controls">
|
||||
<button type="button" class="fedistream-player__btn fedistream-player__btn--play" aria-label="{{ __('Play', 'wp-fedistream') }}">
|
||||
<svg class="fedistream-player__icon fedistream-player__icon--play" viewBox="0 0 24 24" fill="currentColor"><path d="M8 5v14l11-7z"/></svg>
|
||||
<svg class="fedistream-player__icon fedistream-player__icon--pause" viewBox="0 0 24 24" fill="currentColor"><path d="M6 19h4V5H6v14zm8-14v14h4V5h-4z"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
<div class="fedistream-player__progress">
|
||||
<span class="fedistream-player__time fedistream-player__time--current">0:00</span>
|
||||
<div class="fedistream-player__bar">
|
||||
<div class="fedistream-player__bar-progress"></div>
|
||||
<input type="range" class="fedistream-player__seek" min="0" max="100" value="0" aria-label="{{ __('Seek', 'wp-fedistream') }}">
|
||||
</div>
|
||||
<span class="fedistream-player__time fedistream-player__time--total">{{ post.duration_formatted|default('0:00') }}</span>
|
||||
</div>
|
||||
<div class="fedistream-player__volume">
|
||||
<button type="button" class="fedistream-player__btn fedistream-player__btn--volume" aria-label="{{ __('Volume', 'wp-fedistream') }}">
|
||||
<svg viewBox="0 0 24 24" fill="currentColor"><path d="M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z"/></svg>
|
||||
</button>
|
||||
<input type="range" class="fedistream-player__volume-slider" min="0" max="100" value="80" aria-label="{{ __('Volume', 'wp-fedistream') }}">
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
{% endif %}
|
||||
|
||||
{% if post.content %}
|
||||
<section class="fedistream-single__content">
|
||||
<h2 class="fedistream-section__title">{{ __('About This Track', 'wp-fedistream') }}</h2>
|
||||
<div class="fedistream-single__description">
|
||||
{{ post.content|raw }}
|
||||
</div>
|
||||
</section>
|
||||
{% endif %}
|
||||
|
||||
{% if post.lyrics %}
|
||||
<section class="fedistream-single__lyrics">
|
||||
<h2 class="fedistream-section__title">{{ __('Lyrics', 'wp-fedistream') }}</h2>
|
||||
<div class="fedistream-lyrics">
|
||||
{{ post.lyrics|nl2br }}
|
||||
</div>
|
||||
</section>
|
||||
{% endif %}
|
||||
|
||||
{% if post.credits %}
|
||||
<section class="fedistream-single__credits">
|
||||
<h2 class="fedistream-section__title">{{ __('Credits', 'wp-fedistream') }}</h2>
|
||||
<div class="fedistream-credits">
|
||||
{{ post.credits|raw }}
|
||||
</div>
|
||||
</section>
|
||||
{% endif %}
|
||||
|
||||
{% if post.license %}
|
||||
<section class="fedistream-single__license">
|
||||
<p class="fedistream-license">
|
||||
<strong>{{ __('License:', 'wp-fedistream') }}</strong>
|
||||
<a href="{{ post.license.link }}">{{ post.license.name }}</a>
|
||||
</p>
|
||||
</section>
|
||||
{% endif %}
|
||||
</article>
|
||||
Reference in New Issue
Block a user