<?php ?>
<div id="dynamic-category-tab-<?php echo $this->get_id(); ?>" class="layout-2-dynamic-category-tab dynamic-category-tab ">
    <?php if(empty($cat_id)):?>
        <div class="empty-cat">
            <h3>Please select a category first</h3>
        </div>
    <?php endif;?>
    <?php
    /**
     * Argument
     * for query post
     * ================
     */
    $count = 1;
    $args = array(
        'cat' => $cat_id,
        'orderby'	=> 'date',
        'order'		=> 'DESC',
        'post_type' =>  'post',
        'showposts'	=> $post_num_to_show,
        'post__not_in' => get_option("sticky_posts"),
    );
    $query = new WP_Query($args);
    ?>
    <div class="dynamic-category-tab-wrapper">
    <?php
    if($query->have_posts()):
        ?>
        <div id="<?php echo $this->get_id(); ?>" class="post-list-wrapper">
            <div class="post-content">
                <div class="ajax-content"><div class="lds-ellipsis"><div></div><div></div><div></div><div></div></div></div>
                <?php if(has_post_thumbnail()): ?>
                    <div class="tab-post-thumb">
                        <a href="<?php the_permalink(); ?>">
                            <?php the_post_thumbnail('full' ); ?>
                        </a>
                    </div>
                <?php endif; ?>
            </div>
            <div class="regular-post" id="<?php echo $this->get_id(); ?>" >
                <?php
                    while($query->have_posts()):
                        $query->the_post();
                        ?>

                            <div class="regular-post-wrapper <?php echo ($count == 1) ? 'active' : ''; ?>" data-id="<?php echo get_the_ID(); ?>">
                                <div class="post-data">
                                    <div class="post-title">
                                        <a href="<?php the_permalink(); ?>" class="regular-post-title regular-title">
                                            <span class="icon-wrapper">
                                                <i class="fa fa-angle-right"></i>
                                            </span>
                                            <div class="layout-2-title-wrapper">
                                                <h3><?php the_title(); ?></h3>
                                                <?php if('yes' == $show_meta): ?>
                                                    <div class="wkp-post-meta">
                                                        <div class="post-author"><?php echo get_the_author(); ?></div>
                                                        <div class="seperator"> <span><?php esc_html_e('|', 'widgetkit-pro'); ?></span></div>
                                                        <div class="post-date"><?php echo get_the_date(); ?></div>
                                                    </div>
                                                <?php endif; ?>
                                            </div>

                                        </a>
                                    </div>

                                </div>
                            </div>

                        <?php
                        $count++;
                    endwhile;
                    wp_reset_postdata();
                ?>

            </div>
            <div class="post-count-and-navigator">

            </div>
        </div>
        <?php
    endif;
    ?>
    </div>

    
    <?php //wp_reset_query(); ?>

</div>