<?php
get_header();

$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;

$posts = new WP_Query([
    'category_name' => get_queried_object()->slug,
    'post_type' => 'post',
    'posts_per_page' => 10,
    'orderby' => 'date',
    'order' => 'DESC',
    'paged' => $paged
]);
?>
<div class="content-middle articles-wrapper">
    <?php 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">
        <? get_template_part('content-category-events-post', null, ['posts' => $posts, 'category' => get_queried_object()->term_id]) ?>
    </div>
    <?php custom_pagination($posts); ?>
    <a href="<?= home_url(); ?>" class="articles-preview__show-next">На главную</a>
</div>


<?php
get_footer(); ?>