10, // Количество постов для вывода
'post_type' => 'post', // Тип постов для выборки (например, 'post', 'page', 'custom_post_type')
'orderby' => 'date', // Сортировка по дате
'order' => 'DESC', // Направление сортировки (DESC - по убыванию, ASC - по возрастанию)
'category_name' => get_queried_object()->slug
);
$counter = 0;
query_posts( $args );
?>
get_template_part('partials/rubrics-mobile'); ?>
=get_queried_object()->name?>
if ( have_posts() ) : ?>
$counter++; $formatted_date = format_event_date(); ?>
= show_post_image(); ?>
= the_title() ?>
endwhile; ?>
if ($counter == 4) {
$banners = wp_is_mobile() ? get_field('banner_between_posts_mobile', 'option') : get_field('banner_between_posts', 'option');
if($banners){
$rand_keys = array_rand($banners, 1);
if (isset($banners[$rand_keys]) && !empty($banners[$rand_keys]['image_banner'])) {
echo '
';
}
}
}
?>
endif;?>
На главную
custom_pagination(); ?>