<?php
$postNum = 0;
$post_type = (get_queried_object()->name == 'yellow') ? "yellow, anew" : get_queried_object()->name;
?>

<div class="row clearfix d-block">
    <?php get_template_part( 'content-menu-item-header' ); ?>
    <div class="col-12 col-xl-9 float-left">
        <div class="newslist">
            <?php if ( have_posts() ) :  ?>
                <div class="newslist__result">
                    <?php while ( have_posts() ) : $postNum++; the_post(); ?>
                        <?php if(get_the_ID() != 910194): ?>
                            <?php ad_inlist_mobile($postNum); ?>
                            <?php get_template_part( 'content', 'news' ); ?>
                        <?php endif; ?>
                    <?php endwhile; ?>
                    <?php
                    $shortcode = '[ajax_load_more ';
                    if(!is_user_logged_in()){
                        $shortcode .= ' cache="true" cache_id="1'.wp_is_mobile().crc32('archive-news-'.$post_type).get_last_id().'" ';
                    }
                    $shortcode .= ' custom_args="type:short" 
                            id="post_type_archive" 
                            scroll_distance="50" 
                            button_label="Загрузить еще" 
                            container_type="div" 
                            offset="'.(get_option('posts_per_page')).'" 
                            posts_per_page="'.(get_option('posts_per_page')).'" 
                            post_type="'.$post_type.'"
                            ]';
                    ?>
                    <?php echo do_shortcode($shortcode); ?>
                </div>
            <?php endif; ?>
            <div class="hide-if-js">
                <?php
                the_posts_pagination(
                    [
                        'end_size'     => 3,
                        'mid_size'     => 3,
                        'prev_next'    => 0,
                    ]
                );
                ?>
            </div>
        </div>
    </div>
    <div class="col-12 col-xl-3 float-left d-none d-xl-block">
        <div class="right-side">
            <?php dynamic_sidebar('right_sidebar'); ?></div>
            <div class="js-stickybit">
                <?php get_template_part( 'content', 'ad' ); ?>
            </div>
        </div>
    </div>
</div>