<?php ?>
<div class="static-post-tab static-recent-post-tab">

    <?php
    /**
     * Argument
     * for query post
     * ================
     */
    $first_cat_args = array(
        'posts_per_page' => $post_num_to_show,
        'orderby'	=> 'date',
        'order'		=> 'DESC',
        'cat' => $first_cat_id,
        'post__not_in' => get_option("sticky_posts"),
    );
    $second_cat_args = array(
        'posts_per_page' => $post_num_to_show,
        'orderby'	=> 'date',
        'order'		=> 'DESC',
        'cat' => $second_cat_id,
        'post__not_in' => get_option("sticky_posts"),
    );
    ?>
    <div class="latest-between-two-category tab-widget <?php echo  $query_type; ?>">
        <div class="nav-tabs-wrapper">
            <ul class="nav nav-tabs">
                <li class="active">
                    <a data-toggle="tab" href="#category_slug_<?php echo $first_cat_id; ?>">
                        <?php echo esc_html(get_cat_name($first_cat_id)); ?>
                    </a>
                </li>
                <li>
                    <a data-toggle="tab" href="#category_slug_<?php echo $second_cat_id; ?>">
                        <?php echo esc_html(get_cat_name($second_cat_id)); ?>
                    </a>
                </li>
            </ul>
        </div>


        <div class="tab-content <?php echo ('yes' == $show_border) ? 'show-border' : ''; ?>">
            <div id="category_slug_<?php echo $first_cat_id; ?>" class="tab-pane fade in active">
                <ul>
                    <?php $first_cat_query = new WP_Query($first_cat_args); ?>

                    <?php if($first_cat_query->have_posts()):?>
                        <?php while($first_cat_query->have_posts()): $first_cat_query->the_post();?>
                            <li class="fadeIn cat-single-item">

                                <?php if(has_post_thumbnail() && $show_thumb): ?>
                                    <div class="post-thumb-wrapper">
                                        <a class="post-thumb" href="<?php the_permalink()?>">
                                            <?php the_post_thumbnail($regular_thumbnail_size); ?>
                                        </a>
                                    </div>
                                <?php endif; ?>
                                <!-- End post thumbnail section  -->

                                <div class="post-data-wrapper">
                                    <div class="post-data">
                                        <?php if('yes' == $show_cat): ?>
                                            <div class="post-cat">
                                                <?php magmax_limited_cateory_with_seperator_for_elements(get_the_ID()); ?>
                                            </div>
                                        <?php endif; ?>
                                        <div class="post-title">
                                            <a href="<?php the_permalink(); ?>" class="regular-post-title regular-title">
                                                <h3><?php magmax_title($title_word); ?></h3>
                                            </a>
                                        </div>
                                    </div>
                                    <?php if('yes' == $show_meta): ?>
                                        <div class="post-meta">
                                            <span class="post-author"><?php echo get_the_author(); ?></span>
                                            <span class="seperator"> <span><?php esc_html_e('|', 'widgetkit-pro'); ?></span></span>
                                            <span class="post-date"><?php echo get_the_date(); ?></span>
                                        </div>
                                    <?php endif; ?>
                                </div>

                            </li>
                        <?php endwhile; wp_reset_postdata();?>
                    <?php endif; ?>
                    <?php //wp_reset_query() ?>
                </ul>
            </div>
            <div id="category_slug_<?php echo $second_cat_id; ?>" class="tab-pane fade">
                <ul>
                    <?php $second_cat_query = new WP_Query($second_cat_args); ?>
                    <?php if($second_cat_query->have_posts()):?>
                        <?php while($second_cat_query->have_posts()): $second_cat_query->the_post();?>
                            <li class="fadeIn cat-single-item">

                                <?php if(has_post_thumbnail() && $show_thumb): ?>
                                    <div class="post-thumb-wrapper">
                                        <a class="post-thumb" href="<?php the_permalink()?>">
                                            <?php the_post_thumbnail($regular_thumbnail_size); ?>
                                        </a>
                                    </div>
                                <?php endif; ?>
                                <!-- End post thumbnail section  -->

                                <div class="post-data-wrapper">
                                    <div class="post-data">
                                        <?php if('yes' == $show_cat): ?>
                                        <div class="post-cat">
                                            <?php magmax_limited_cateory_with_seperator_for_elements(get_the_ID()); ?>
                                        </div>
                                        <?php endif; ?>
                                        <div class="post-title">
                                            <a href="<?php the_permalink(); ?>" class="regular-post-title regular-title">
                                                <h3><?php magmax_title($title_word); ?></h3>
                                            </a>
                                        </div>
                                    </div>
                                    <?php if('yes' == $show_meta): ?>
                                    <div class="post-meta">
                                        <span class="post-author"><?php echo get_the_author(); ?></span>
                                        <span class="seperator"> <span><?php esc_html_e('|', 'widgetkit-pro'); ?></span></span>
                                        <span class="post-date"><?php echo get_the_date(); ?></span>
                                    </div>
                                    <?php endif; ?>
                                </div>

                            </li>
                        <?php endwhile; wp_reset_postdata();?>
                    <?php endif; ?>
                    <?php //wp_reset_query(); ?>
                </ul>
            </div>

        </div>

    </div>
    <?php  //wp_reset_query(); ?>
</div>