<div class="gt-blog-8-wrap">
<?php
    if ( $query->have_posts() ) {
    $i = 0;
    while ( $query->have_posts() ) {
    $query->the_post();
        $tags = get_the_tags(get_the_ID());
        $categories = get_the_terms( get_the_ID(), 'category' );
        $i++;
?>
<div class="gt-blog-8-card">
    <?php if(has_post_thumbnail()):?>
        <div class="main-img">
            <?php the_post_thumbnail( 'full' );?>
        </div>
    <?php endif;?>
    <div>
        <span class="date"><?php echo get_the_date(); ?></span>
        <h5 class="title"><a href="<?php the_permalink()?>"><?php echo wp_trim_words(get_the_title(), $settings['title_length'], '')  ;?></a></h5>
    </div>
</div>
<?php } wp_reset_query(); } ?>
</div>