<!--category-template-->
<?php get_header(); ?>
    <div class="row clearfix">
        <div class="col-12 col-md-8 col-xl-9">
            <?php if(is_in_dk()): ?>
                <div class="dk-banner">
                    <img class="w-100 mb-4" src="<?= get_template_directory_uri() ?>/assets/img/Delovoy_club_852x80_2.jpg" />
                </div>
            <?php endif; ?>
            <div class="row clearfix d-block">
                <?php get_template_part( 'content-menu-item-header' ); ?>
                <?php if ( have_posts() ) : ?>
                        <?php
                                $rand = rand(4,5);
                                $postNum = 0;
                                while ( have_posts() ) : $postNum++;
                                    ad_inlist_mobile($postNum);
                                    the_post();
                                    if ($postNum == $rand && $already == false ):
                                        $already = true;
                                        get_template_part( 'content', 'preview-long-rubrick' );
                                    else:
                                        get_template_part( 'content', 'preview-short-rubrick' );
                                    endif;
                                endwhile;
                                if (is_tag()):
                                    echo do_shortcode('[ajax_load_more cache="true" cache_id="'.wp_is_mobile().crc32('archive-category-tag').get_queried_object_id().get_last_id().'" id="category_request" scroll_distance="50" button_label="Загрузить еще" container_type="div" post_type="profile_article,anew" offset="'.(get_option('posts_per_page')).'" posts_per_page="10" tag__and="'.get_queried_object()->term_id.'"]');
                                endif;
                                if(is_category()):
                                        $cat = get_queried_object()->term_id;
                                        $category = get_category ($cat);
                                        if($category->slug == "columnist"){
                                            #mail("viral@profile.ru","test",$wpdb->last_query);
                                        }
                                        echo do_shortcode('[ajax_load_more cache="true" cache_id="'.wp_is_mobile().crc32('archive-category-category').get_queried_object_id().get_last_id().'" id="category_request" scroll_distance="50" button_label="Загрузить еще" container_type="div" post_type="profile_article,anew" offset="'.(get_option('posts_per_page')).'" posts_per_page="10" category="'.$category->slug.'"]');
                                endif;
                                if(is_author()):
                                    echo do_shortcode('[ajax_load_more cache="true" cache_id="'.wp_is_mobile().crc32('archive-category-author').get_queried_object_id().get_last_id().'" id="author_request" scroll_distance="50" button_label="Загрузить еще" container_type="div" post_type="profile_article" offset="'.(get_option('posts_per_page')).'" posts_per_page="10" author="'.get_the_author_ID().'" ]');
                                endif;
                        ?>
                    <div class="hide-if-js">
                        <?php
                        the_posts_pagination(
                            [
                                'end_size'     => 3,
                                'mid_size'     => 3,
                                'prev_next'    => 0,
                            ]
                        );
                        ?>
                    </div>
                <?php
                        else :
                                get_template_part( 'content', 'none' );
                        endif;
                ?>
            </div>
        </div>
        <div class="col-12 col-md-4 col-xl-3">
            <div class="right-side">
                    <?php dynamic_sidebar('right_sidebar'); ?></div>
                    <div class="js-stickybit">
                        <?php get_template_part( 'content', 'ad' ); ?>
                    </div>
            </div>
        </div>
    </div>
<?php get_footer(); ?>