<?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-latest">
        <?php if(has_post_thumbnail()):?>
            <div class="main-img">
                <?php the_post_thumbnail( 'full' );?>
            </div>
        <?php endif;?>
        <div class="content">
            <span class="category"><?php if ( ! empty( $categories ) ) {
                            echo esc_html( $categories[0]->name );	
                        } ?></span>
            <h4 class="title"><a href="<?php the_permalink()?>"><?php echo wp_trim_words(get_the_title(), $settings['title_length'], '')  ;?></a></h4>
            <p class="disc"><?php echo wp_trim_words(get_the_excerpt(), $settings['excerpt_length'], '')  ;?></p>
            <div class="meta">
                <div class="author">
                    <div class="auth-img">
                        <?php echo goyto_post_author_avatars(size: 52);?>
                    </div>
                    <div>
                        <span class="auth-title"><?php esc_html_e('Poster By', 'goyto-plugin')?></span>
                        <h5 class="auth-name"><?php the_author();?></h5>
                    </div>
                </div>
                <div class="publish">
                    <span class="icon">
                        <i class="flaticon-mail-inbox-app"></i>
                    </span>
                    <div>
                        <span class="date-title"><?php esc_html_e('Poster Date', 'goyto-plugin')?></span>
                        <h5 class="date-number"><?php echo get_the_date(); ?></h5>
                    </div>
                </div>
            </div>
        </div>
    </div>
<?php } wp_reset_query(); } ?>