<?php
$categories = get_the_category($post->ID);
if ($categories) :
    $category_ids = array();
    foreach($categories as $individual_category) {
        $category_ids[] = $individual_category->term_id;
    }
    $args = array(
        'category__in'        => $category_ids,
        'post__not_in'        => array($post->ID),
        'posts_per_page'      => 3,
        'ignore_sticky_posts' => 1,
        'orderby'             => 'rand'
    );
    $new_query = new wp_query( $args );
?>
    <?php if( $new_query->have_posts() ) : ?>
    <div class="auliettalite-post-related">
            <h4 class="post-related-title"><?php esc_html_e('You Might Also Like', 'auliettalite'); ?></h4>
            <div class="row">
            <?php while( $new_query->have_posts() ) : $new_query->the_post(); ?>
                <div class="col-md-6 col-lg-4 item-relate">
                    <div class="post-entryformat">
                        <?php get_template_part('template-parts/post', 'format'); ?>
                        <div class="wrap-post-date">
                            <span class="date"><?php echo wp_kses_post( get_the_date('d') ); ?></span>
                            <span class="month"><?php echo wp_kses_post( get_the_date('M') ); ?></span>
                        </div>
                    </div>
                    <div class="post-info">
                        <div class="post-cats"><?php the_category(' / '); ?></div>
                        <h3 class="post-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
                    </div>
                </div>
            <?php endwhile; ?>
            </div>
        </div>
    <?php endif; ?>
<?php endif;
wp_reset_query();