Как убрать выборку постов, но оставить вывод месяца относящийся к постам (месяц выводится над группами постов, которые имеют один и тот же месяц)
Мне нужно убрать только выборку:
<div class="boxcontainer">
<?php $last_month_args = array(
        'post_type' => 'post',
        'post_status' => 'publish',
        'orderby' => 'date',
        'paged' => $paged,
        'date_query' => array( array( 'after' => '1 year ago' )));
        $last_month_posts = new WP_Query( $last_month_args );
        // создадим пустую переменную
        $ym_ = "";
        if ( $last_month_posts->have_posts() ) {
            while ( $last_month_posts->have_posts() ) {
                $last_month_posts->the_post();
                // запишем год и месяц
                $ym = get_the_date('Ym', $post->ID);
                // другой год или месяц
                if ( $ym_ != $ym ) {
                    // выведем месяц и год
                    echo '<h3 class="pinbox">'.get_the_date('F Y', $post->ID).'</h3>';
                }
                // выведем пост из шаблона
                get_template_part('pinbox', get_post_format());
                // сохраним текущий месяц и год для сравнения со следующей записью
                $ym_ = $ym;
            }
        }else{}
        wp_reset_postdata(); ?>
</div>
Спасибо!