<?php

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

    $y = ((int)get_query_var("event_year") > 0) ? (int)get_query_var("event_year") : '*';
    $m = ((int)get_query_var("event_month") > 0) ? str_pad((int)get_query_var("event_month"), 2, '0', STR_PAD_LEFT) : '*';
    $d = ((int)get_query_var("event_day") > 0) ? str_pad((int)get_query_var("event_day"), 2, '0', STR_PAD_LEFT) : '*';

?>
<div class="row clearfix d-block">
    <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">
                <a href="/events">Календарь событий</a>
            </h1>
        </div>
    </div>
    <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 get_template_part( 'content', 'events' ); ?>
                    <?php endwhile; ?>
                    <?php //echo do_shortcode('[ajax_load_more cache="true" cache_id="'.wp_is_mobile().crc32('archive-events').((int)$y).((int)$m).((int)$d).get_last_id().'" custom_args="date:'.$y.'-'.$m.'-'.$d.'" id="events_request" scroll_distance="50" button_label="Загрузить еще" container_type="div" offset="'.(get_option('posts_per_page')).'" posts_per_page="12" post_type="anew, yellow"]'); ?>
                </div>
            <?php endif; ?>
        </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>