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:
47
templates/partials/card-artist.php
Normal file
47
templates/partials/card-artist.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?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>
|
||||
Reference in New Issue
Block a user