<?php if ($settings['show_button'] == 'yes' && !empty( $settings['button_text'] )): ?>
    <a href="<?php //echo get_the_permalink(); ?>" class="tf-portfolio-btn"><?php esc_html_e($settings['button_text'],'norstar'); ?></a>
<?php endif; ?>
<div class="tf-portfolio-container big-<?php echo esc_attr($settings['layout']); ?>">
    <?php

    $content_odd = '<div class="tf-portfolio-column tf-portfolio-odd-column vertical-layout-'. esc_attr($settings['layout_col_odd']) . ' ">';
    $content_even = '<div class="tf-portfolio-column tf-portfolio-even-column vertical-layout-'. esc_attr($settings['layout_col_even']) . ' ">';
    ?>
    <?php
    $index = 0;
    while ($query->have_posts()) : $query->the_post();
        $item_html = '';
        ob_start();
    ?>
        <div class="item">
           
            <div class="portfolios-post portfolios-post-<?php the_ID(); ?>">
                <div class="featured-post">
                    <a href="<?php echo get_the_permalink(); ?>">
                        <?php
                        if (has_post_thumbnail()) {
                            echo sprintf('<img src="%s" alt="image">', \Elementor\Group_Control_Image_Size::get_attachment_image_src(get_post_thumbnail_id(), 'thumbnail', $settings));
                        }
                        ?>
                    </a>
                    
                </div>
                <div class="content">
                    <h4>
                        <a href="<?php echo get_the_permalink(); ?>" class="title"><?php esc_html_e(get_the_title(), 'norstar'); ?></a>
                    </h4>
                    <p class="description">
                        <?php echo wp_trim_words(get_the_excerpt(), $settings['excerpt_lenght'], ''); ?>
                    </p>
                </div>
            </div>
        </div>
    <?php
        $item_html = ob_get_clean();

        if ($index % 2 != 0) {
            $content_odd .= $item_html;
        } else {
            $content_even .= $item_html;
        }

        $index++;
    endwhile;
    ?>

    <?php
    $content_odd .= '</div>';
    $content_even .= '</div>';
    ?>

    <?php
    echo wp_kses($content_even, themesflat_kses_allowed_html());
    echo wp_kses($content_odd, themesflat_kses_allowed_html());
    ?>
</div>