Merge branch 'master' of https://git.good-production.xyz/Good-Production/cosmopet-architecture
commit
0ffa6707e0
After Width: | Height: | Size: 1.5 KiB |
@ -1,3 +1,7 @@ |
|||||||
main{ |
main{ |
||||||
padding-top: 72px; |
padding-top: 72px; |
||||||
|
} |
||||||
|
|
||||||
|
.block-lists_text p { |
||||||
|
font-size: 18px!important; |
||||||
} |
} |
@ -0,0 +1,10 @@ |
|||||||
|
@media(max-width:600px) { |
||||||
|
.article-content h2 { |
||||||
|
max-width: 661px; |
||||||
|
font-size: 24px!important; |
||||||
|
line-height: 40px; |
||||||
|
font-weight: bold; |
||||||
|
text-transform: uppercase; |
||||||
|
color: var(--grey-black); |
||||||
|
} |
||||||
|
} |
@ -1,23 +1,22 @@ |
|||||||
<?php |
<?php |
||||||
|
|
||||||
|
|
||||||
add_filter('timber/context', function($context) { |
add_filter('timber/context', function($context) { |
||||||
$current_category = get_queried_object(); // Получаем текущую категорию |
// Простой запрос для получения последних постов |
||||||
|
|
||||||
$args = array( |
$args = array( |
||||||
'post_type' => 'post', |
'post_type' => 'post', |
||||||
'posts_per_page' => 3, // Количество постов |
'posts_per_page' => 3, |
||||||
'orderby' => 'meta_value_num', |
'orderby' => 'date', |
||||||
'key' => 'post_views', // Поле плагина для подсчёта просмотров |
'order' => 'DESC' |
||||||
'order' => 'DESC', // Сортировка по убыванию |
|
||||||
|
|
||||||
// Условие для фильтрации по текущей категории |
|
||||||
'category__in' => $current_category ? array($current_category->term_id) : '', |
|
||||||
); |
); |
||||||
|
|
||||||
$most_read_query = new WP_Query($args); |
$most_read_query = new WP_Query($args); |
||||||
$most_read = new Timber\PostQuery($most_read_query); |
$most_read = new Timber\PostQuery($most_read_query); |
||||||
|
|
||||||
$context['most_read'] = $most_read; |
$context['most_read'] = $most_read; |
||||||
|
|
||||||
|
// Добавляем отладочную информацию |
||||||
|
global $wpdb; |
||||||
|
$debug_info = $wpdb->get_results("SELECT post_id, meta_key, meta_value FROM {$wpdb->postmeta} WHERE meta_key LIKE '%view%' LIMIT 5"); |
||||||
|
$context['debug_info'] = $debug_info; |
||||||
|
|
||||||
return $context; |
return $context; |
||||||
}); |
}); |
@ -1,36 +1,50 @@ |
|||||||
<div class="anons-best"> |
<div class="anons-best"> |
||||||
<h2 class="anons-best__title">{{ function('pll_e', 'САМЫЕ ЧИТАЕМЫЕ') }}:</h2> |
<h2 class="anons-best__title">{{ function('pll_e', 'САМЫЕ ЧИТАЕМЫЕ') }}:</h2> |
||||||
<ul class="anons-best__card-wrap"> |
|
||||||
{% for post in most_read %} |
<!-- Отладочная информация --> |
||||||
<li class="anons-best__card"> |
{% if debug_info %} |
||||||
<ul class="anons-best__card-alerts"> |
<div style="display:none;"> |
||||||
{% for category in post.categories %} |
<p>Метаполя с просмотрами:</p> |
||||||
<li> |
<ul> |
||||||
<a href="{{ category.link }}">{{ category.name }}</a> |
{% for item in debug_info %} |
||||||
</li> |
<li>ID: {{ item.post_id }}, Ключ: {{ item.meta_key }}, Значение: {{ item.meta_value }}</li> |
||||||
{% endfor %} |
{% endfor %} |
||||||
</ul> |
</ul> |
||||||
<a href="{{post.link}}" class="main-img"> |
</div> |
||||||
<img src="{{post.thumbnail.src}}" alt="{{post.thumbnail.alt}}"> |
{% endif %} |
||||||
</a> |
|
||||||
<div class="anons-best__card-body"> |
{% if most_read and most_read|length > 0 %} |
||||||
<a href="{{post.link}}" class="anons-best__card-body__title">{{post.title}}</a> |
<ul class="anons-best__card-wrap"> |
||||||
<div class="anons-best__card-body__datas"> |
{% for post in most_read %} |
||||||
<p>{{post.date}}</p> |
<li class="anons-best__card"> |
||||||
<p>{{ function('pll_e', 'время чтения') }}: {{post.reading_time}}</p> |
<ul class="anons-best__card-alerts"> |
||||||
<ul> |
{% for category in post.categories %} |
||||||
{% if post.get_author_name %} |
<li> |
||||||
<li class="logo"> |
<a href="{{ category.link }}">{{ category.name }}</a> |
||||||
<img src="{{post.get_author_img}}" alt=""> |
</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> |
||||||
|
{% if post.get_author_name %} |
||||||
|
<li class="logo"> |
||||||
|
<img src="{{ post.get_author_img|default('https://via.placeholder.com/40') }}" alt="{{ post.get_author_name }}"> |
||||||
</li> |
</li> |
||||||
|
|
||||||
{% endif %} |
{% endif %} |
||||||
</ul> |
</ul> |
||||||
|
</div> |
||||||
</div> |
</div> |
||||||
</div> |
</li> |
||||||
</li> |
{% endfor %} |
||||||
{% endfor %} |
</ul> |
||||||
</ul> |
{% else %} |
||||||
</div> |
<p>Нет доступных постов для отображения.</p> |
||||||
|
{% endif %} |
||||||
|
</div> |
Loading…
Reference in new issue