new block promo agg

This commit is contained in:
2023-12-15 16:52:30 +03:00
parent 19a7e3f4a1
commit 44ef31d4eb
9 changed files with 127 additions and 22 deletions

View File

@@ -1,5 +1,8 @@
<?php $posts = get_posts( array(
'numberposts' => 4,
<?php
$yets_params = [
'numberposts' => 4,
'category' => $category_id, // текущая рубрика
'orderby' => 'date',
'order' => 'DESC',
@@ -8,9 +11,15 @@
'meta_key' => '',
'meta_value' =>'',
'post_type' => 'post',
'post__not_in' => array($post_id),
'suppress_filters' => true, // подавление работы фильтров изменения SQL запроса
) );
];
if (isset($post_id)){
$yets_params['post__not_in'] = array($post_id);
}
$posts = get_posts($yets_params);
# вывод поста
if( $posts ):