You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
cosmopet-architecture/wp-content/themes/cosmopet/views/blog/most-read.twig

51 lines
2.5 KiB

{% set current_path = template_path ~ '/modules/blog/components/most-read' %}
{% if not fn('is_category') %}
<div class="anons-best">
<h2 class="anons-best__title">{{ function('pll_e', 'САМЫЕ ЧИТАЕМЫЕ') }}:</h2>
{% if most_read and most_read|length > 0 %}
<ul class="anons-best__card-wrap">
{% for post in most_read %}
<li class="anons-best__card">
<ul class="anons-best__card-alerts">
{% for category in post.categories %}
<li>
<a href="{{ category.link }}">{{ category.name }}</a>
</li>
{% endfor %}
</ul>
<a href="{{ post.link }}" class="main-img">
<img src="{{ post.thumbnail.src|default('https://via.placeholder.com/150') }}" alt="{{ post.thumbnail.alt|default(post.title) }}">
</a>
<div class="anons-best__card-body">
<a href="{{ post.link }}" class="anons-best__card-body__title">{{ post.title }}</a>
<div class="anons-best__card-body__datas">
<p>{{ post.date|date('d.m.Y') }}</p>
<p>{{ function('pll_e', 'время чтения') }}: {{ post.reading_time|default('5 мин') }}</p>
<ul class="anons-best__card-meta">
<li>
<img src="{{ current_path }}/assets/img/heart-white.svg" alt="">
<span>{{ function('get_post_likes_count', post.ID) }}</span>
</li>
<li>
<img src="{{ current_path }}/assets/img/msg-white.svg" alt="">
<span>{{ post.comment_count }}</span>
</li>
{% if post.get_author_name %}
<li class="logo">
<a href="{{ post.get_author_link }}">
<img src="{{ post.get_author_img|default('https://via.placeholder.com/40') }}" alt="{{ post.get_author_name }}">
</a>
</li>
{% endif %}
</ul>
</div>
</div>
</li>
{% endfor %}
</ul>
{% else %}
<p>Нет доступных постов для отображения.</p>
{% endif %}
</div>
{% endif %}