67 lines
3.0 KiB
PHP
67 lines
3.0 KiB
PHP
|
|
<?php
|
|||
|
|
|
|||
|
|
$args = array(
|
|||
|
|
'posts_per_page' => 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 );
|
|||
|
|
|
|||
|
|
?>
|
|||
|
|
|
|||
|
|
<?php get_header() ?>
|
|||
|
|
<div class="content-middle articles-wrapper">
|
|||
|
|
|
|||
|
|
<? get_template_part('partials/rubrics-mobile'); ?>
|
|||
|
|
<div class="section-title border-top">
|
|||
|
|
<h1 class="section-title__title"><?=get_queried_object()->name?></h1>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<div class="articles-preview">
|
|||
|
|
<? if ( have_posts() ) : ?>
|
|||
|
|
<?while ( have_posts() ) : the_post();?>
|
|||
|
|
<? $counter++; $formatted_date = format_event_date(); ?>
|
|||
|
|
<a href="<? the_permalink(); ?>">
|
|||
|
|
<div class="article-item">
|
|||
|
|
<div class="interview-item__image-container">
|
|||
|
|
<?= show_post_image(); ?>
|
|||
|
|
<button class="item-video__button subtitle-20">
|
|||
|
|
<img src="<?= get_asset('icons/play.svg') ?>" alt=""/> Интервью
|
|||
|
|
</button>
|
|||
|
|
</div>
|
|||
|
|
<div class="article-item__text">
|
|||
|
|
<div class="article-time">
|
|||
|
|
<img src="<?= get_asset('icons/time.svg') ?>" alt=""/>
|
|||
|
|
<time><?= $formatted_date; ?></time>
|
|||
|
|
</div>
|
|||
|
|
<a href="<? the_permalink(); ?>" class="subtitle-16 article-item__link">
|
|||
|
|
<?= the_title() ?>
|
|||
|
|
</a>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</a>
|
|||
|
|
<? 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 '<a href="' . $banners[$rand_keys]['link'] . '">
|
|||
|
|
<div class="banner-middle">
|
|||
|
|
<img src="' . $banners[$rand_keys]["image_banner"]["url"] . '" alt="">
|
|||
|
|
</div>
|
|||
|
|
</a>';
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
?>
|
|||
|
|
<? endif;?>
|
|||
|
|
<a href="<?= home_url(); ?>" class="articles-preview__show-next mobile">На главную</a>
|
|||
|
|
</div>
|
|||
|
|
<? custom_pagination(); ?>
|
|||
|
|
</div>
|
|||
|
|
<?php
|
|||
|
|
get_footer() ?>
|