Files
vij/blocks/yets.php

51 lines
1.0 KiB
PHP
Raw Normal View History

2023-12-15 16:52:30 +03:00
<?php
$yets_params = [
'numberposts' => 4,
2021-09-24 23:18:38 +03:00
'category' => $category_id, // текущая рубрика
2021-09-20 01:07:53 +03:00
'orderby' => 'date',
'order' => 'DESC',
'include' => array(),
'exclude' => array(),
'meta_key' => '',
'meta_value' =>'',
'post_type' => 'post',
'suppress_filters' => true, // подавление работы фильтров изменения SQL запроса
2023-12-15 16:52:30 +03:00
];
if (isset($post_id)){
$yets_params['post__not_in'] = array($post_id);
}
$posts = get_posts($yets_params);
2021-09-20 01:07:53 +03:00
# вывод поста
2022-08-17 00:29:25 +03:00
if( $posts ):
$nn = 0;?>
2022-02-15 21:00:14 +03:00
<div class="yets_rubric"><?=vij_lang('more', LANG_VERSION)?></div>
2021-09-20 01:07:53 +03:00
<div class="yets">
<?php foreach($posts as $post):
2022-08-17 00:29:25 +03:00
setup_postdata( $post );
$nn++;?>
2021-09-20 01:07:53 +03:00
2022-08-17 00:29:25 +03:00
<div class="yet_card" id="yets-<?=$nn?>">
2021-09-20 01:07:53 +03:00
<div class="yet_title"><a href="<?php the_permalink(); ?>"><?php the_title();?></a></div>
</div>
<?php endforeach;?>
</div>
<?php wp_reset_postdata();
endif?>