You've already forked wp-fedistream
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>
73 lines
3.0 KiB
PHP
73 lines
3.0 KiB
PHP
<?php
|
|
/**
|
|
* Taxonomy archive template (Genre, Mood).
|
|
*
|
|
* @package WP_FediStream
|
|
*
|
|
* @var array $posts Array of post data.
|
|
* @var string $archive_title Archive title.
|
|
* @var string $archive_description Archive description.
|
|
* @var string $taxonomy_name Taxonomy name (Genre, Mood).
|
|
* @var object $term Current term object.
|
|
* @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--taxonomy">
|
|
<header class="fedistream-archive__header">
|
|
<h1 class="fedistream-archive__title">
|
|
<?php if ( ! empty( $taxonomy_name ) ) : ?>
|
|
<?php echo esc_html( $taxonomy_name ); ?>:
|
|
<?php endif; ?>
|
|
<?php echo esc_html( $archive_title ?? '' ); ?>
|
|
</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--mixed">
|
|
<?php foreach ( $posts as $post ) : ?>
|
|
<?php
|
|
$post_type = $post['post_type'] ?? '';
|
|
switch ( $post_type ) {
|
|
case 'fedistream_artist':
|
|
echo $plugin->render_partial( 'partials/card-artist', array( 'post' => $post ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
|
break;
|
|
case 'fedistream_album':
|
|
echo $plugin->render_partial( 'partials/card-album', array( 'post' => $post ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
|
break;
|
|
case 'fedistream_track':
|
|
echo $plugin->render_partial( 'partials/card-track', array( 'post' => $post ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
|
break;
|
|
case 'fedistream_playlist':
|
|
echo $plugin->render_partial( 'partials/card-playlist', array( 'post' => $post ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
|
break;
|
|
}
|
|
?>
|
|
<?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 content found in this category.', 'wp-fedistream' ); ?></p>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|