<?php ?>
<div class="recent-post-slider">
    
    <?php
    /**
     * Argument
     * for query post
     * ================
     */
    $count = 1;
    if($query_post_type == 'recent'):
        $args = array(
            'cat' => $cat_id,
            'orderby'	=> 'date',
            'order'		=> 'DESC',
            'post_type' =>  'post',
            'showposts'	=> $post_num_to_show,
            'post__not_in' => get_option("sticky_posts"),
        );
    elseif ($query_post_type == 'popular'):
        $args = array(
            'posts_per_page' => $post_num_to_show,
            'meta_key' => 'magmax_post_views_count',
            'orderby' => 'meta_value_num',
            'order' => 'DESC',
            'ignore_sticky_posts' => 1
        );
    elseif ($query_post_type == 'featured'):
        $args = array(
            'posts_per_page' => $post_num_to_show,
            'ignore_sticky_posts' => 1,
            'post_type' => 'post',
            'meta_query' => array(
                array(
                    'key'  => 'post-type',
                    'value' => 'featured',
                    'compare'   => '=',
                )
            )
        );
    elseif ($query_post_type == 'trending'):
        $args = array(
            'posts_per_page' => $post_num_to_show,
            'ignore_sticky_posts' => 1,
            'post_type' => 'post',
            'meta_query' => array(
                array(
                    'key'  => 'post-type',
                    'value' => 'trending',
                    'compare'   => '=',
                )
            )
        );
    endif;
    $query = new WP_Query($args);
    ?>
    <div class="<?php echo $query_post_type; ?>-post-slides grid-slider">
        <div class='ajax-content'><div class='lds-ellipsis'><div></div><div></div><div></div><div></div></div></div>
    <?php
    if($query->have_posts()):
        ?>
        <div class="cat-post-list-wrapper owl-carousel loading">
            <?php
            while($query->have_posts()):
                $query->the_post();
                ?>
                    <div class="regular-post">
                        <div class="regular-post-wrapper ">
                            <?php if(has_post_thumbnail()): ?>
                                <div class="post-thumb">
                                    <a href="<?php the_permalink(); ?>">
                                        <?php the_post_thumbnail($regular_thumbnail_size ); ?>
                                    </a>
                                </div>
                            <?php else:?>
                                <div class="post-thumb no-thumbanil">
                                    <a href="<?php the_permalink(); ?>">
                                        <img src="<?php echo esc_url(WKP_PLACEHOLDER_URL); ?>" alt="">
                                    </a>
                                </div>
                            <?php endif; ?>
                            <div class="post-data">
                                <div class="post-title">
                                    <!-- <div class="post-tag">
                                        <a href="<?php //echo get_category_link($cat_id); ?>" >
                                            <?php //echo get_cat_name($cat_id); ?>
                                        </a>
                                    </div> -->
                                    <a href="<?php the_permalink(); ?>" class="regular-post-title regular-title">
                                        <h3><?php the_title(); ?></h3>
                                    </a>
                                </div>
                                <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 //if($show_excerpt): ?>
                                    <!-- <div class="post-excerpt"><?php echo wp_trim_words(get_the_excerpt(), '50', ''); ?></div> -->
                                <?php //endif; ?>
                            </div>
                        </div>
                    </div>
                <?php
                $count++;
            endwhile;
            wp_reset_postdata();
            ?>
        </div>
        <?php
    endif;
    ?>
    </div>

    <?php  //wp_reset_query(); ?>
    <script>
        jQuery(function($){
            $(document).ready(function(){
                $('.grid-slider .ajax-content').remove();
            });
        });

    </script>
</div>