Files
wp-fedistream/templates/widgets/featured-artist.twig

42 lines
2.2 KiB
Twig
Raw Normal View History

{# Featured Artist Widget Template #}
{% if post %}
<div class="fedistream-widget__featured">
<a href="{{ post.permalink }}" class="fedistream-widget__featured-link">
{% if post.thumbnail %}
<img src="{{ post.thumbnail }}" alt="{{ post.title|e('html_attr') }}" class="fedistream-widget__featured-image">
{% else %}
<span class="fedistream-widget__placeholder fedistream-widget__placeholder--large">
<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>
</span>
{% endif %}
</a>
<div class="fedistream-widget__featured-info">
<h4 class="fedistream-widget__featured-name">
<a href="{{ post.permalink }}">{{ post.title }}</a>
</h4>
{% if post.artist_type %}
<span class="fedistream-widget__featured-type">{{ post.artist_type }}</span>
{% endif %}
{% if post.genres is not empty %}
<div class="fedistream-widget__featured-genres">
{% for genre in post.genres|slice(0, 3) %}
<a href="{{ genre.link }}" class="fedistream-tag fedistream-tag--small">{{ genre.name }}</a>
{% endfor %}
</div>
{% endif %}
{% if post.album_count or post.track_count %}
<div class="fedistream-widget__featured-stats">
{% if post.album_count %}
<span>{{ post.album_count }} {{ post.album_count == 1 ? __('album', 'wp-fedistream') : __('albums', 'wp-fedistream') }}</span>
{% endif %}
{% if post.track_count %}
<span>{{ post.track_count }} {{ post.track_count == 1 ? __('track', 'wp-fedistream') : __('tracks', 'wp-fedistream') }}</span>
{% endif %}
</div>
{% endif %}
</div>
</div>
{% else %}
<p class="fedistream-widget__empty">{{ __('No artist selected.', 'wp-fedistream') }}</p>
{% endif %}