<div class="portfolios">
    <?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="grid-portfolio">

        <?php while ($query->have_posts()) : $query->the_post(); ?>
            <?php $post_categories = wp_get_post_terms(get_the_ID(), 'portfolios_category', array('fields' => 'names')); ?>        

            <div class="item portfolio">
                <?php if (has_post_thumbnail()) : ?>
                    <div class="feature_portfolio_post featured-post">
                        <a href="<?php echo esc_attr(get_the_permalink()); ?>">
                            <?php echo sprintf('<img src="%s" alt="image">', \Elementor\Group_Control_Image_Size::get_attachment_image_src(get_post_thumbnail_id(), 'thumbnail', $settings)); ?>
                        </a>                       
                    </div>
                <?php endif; ?>
                <div class="content">
                    <h4>
                        <a href="<?php echo esc_attr(get_the_permalink()); ?>" class="title"><?php esc_html_e(get_the_title(), 'norstar'); ?></a>
                    </h4>
                    <div class="categories">
                        <?php foreach ($post_categories as $key => $category) : ?>
                            <a href="<?php echo esc_attr(get_term_link($category, 'portfolios_category')); ?>">
                                <?php esc_html_e($category); ?>
                            </a>
                        <?php endforeach ?>
                    </div>
                </div>
            </div>

        <?php endwhile; ?>
    </div>
</div>
