<?php get_header(); ?>
    <div class="row clearfix">
        <div class="col-12 col-md-8 col-xl-9 order-2 order-sm-1">
            <div class="d-flex justify-content-start align-items-center mb-3">
                <h1 class="fs-38 font-weight-bold">
                    Календарь событий
                </h1>
            </div>
        </div>
        <div class="col-12 col-md-8 col-xl-9 order-2 order-sm-1">
            <div class="row clearfix d-block">
                <?php if ( have_posts() ) : ?>
                    <?php
                    $rand = rand(4,5);
                    while ( have_posts() ) : $postNum++;
                        ad_inlist_mobile($postNum);
                        the_post();
                        if ($postNum == $rand && $already == false ):
                            $already = true;
                            get_template_part( 'content', 'preview-long-event' );
                        else:
                            get_template_part( 'content', 'preview-short-event' );
                        endif;
                    endwhile;
                    ?>
                <?php
                endif;
                echo do_shortcode('[ajax_load_more cache="true" cache_id="'.wp_is_mobile().crc32('archive-allevents').get_last_id().'" id="allevents_request" scroll_distance="50" button_label="Загрузить еще" container_type="div" post_type="anew, yellow" offset="'.(get_option('posts_per_page')).'" posts_per_page="10" ]');
                ?>
            </div>
        </div>
        <div class="col-12 col-md-4 col-xl-3 order-1 order-sm-2">
            <div class="right-side">
                <?php dynamic_sidebar('right_sidebar'); ?></div>
                <?php if(!wp_is_mobile()): ?>
                    <div class="js-stickybit">
                        <?php get_template_part( 'content', 'ad' ); ?>
                    </div>
                <?php endif; ?>
            </div>
        </div>
    </div>

<?php get_footer(); ?>