Files

50 lines
1.7 KiB
PHP
Raw Permalink Normal View History

<?php
/**
* Track archive template.
*
* @package WP_FediStream
*
* @var array $posts Array of track data.
* @var string $archive_title Archive title.
* @var string $archive_description Archive description.
* @var array $pagination Pagination data.
*/
// Prevent direct file access.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
$plugin = \WP_FediStream\Plugin::get_instance();
?>
<div class="fedistream-archive fedistream-archive--tracks">
<header class="fedistream-archive__header">
<h1 class="fedistream-archive__title"><?php esc_html_e( 'Tracks', 'wp-fedistream' ); ?></h1>
<?php if ( ! empty( $archive_description ) ) : ?>
<div class="fedistream-archive__description"><?php echo wp_kses_post( $archive_description ); ?></div>
<?php endif; ?>
</header>
<?php if ( ! empty( $posts ) && is_array( $posts ) ) : ?>
<div class="fedistream-grid fedistream-grid--tracks">
<?php foreach ( $posts as $post ) : ?>
<?php echo $plugin->render_partial( 'partials/card-track', array( 'post' => $post ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
<?php endforeach; ?>
</div>
<?php if ( ! empty( $pagination['links'] ) ) : ?>
<nav class="fedistream-pagination">
<?php
foreach ( $pagination['links'] as $link ) {
echo $link; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
?>
</nav>
<?php endif; ?>
<?php else : ?>
<div class="fedistream-empty">
<p><?php esc_html_e( 'No tracks found.', 'wp-fedistream' ); ?></p>
</div>
<?php endif; ?>
</div>