<?php
$paged = get_query_var('paged');
$query_args = array('showposts' => $num , 'order_by' => $sort , 'order' => $order, 'paged'=>$paged);
if( $cat ) $query_args['category'] = $cat;
$query = new WP_Query($query_args) ; 
?>

<?php if ( $query->have_posts() ) :  ?>

    <!--Blog Section-->
    <section class="blog-section blog-page">
    	<div class="auto-container">
        	<div class="row clearfix">
            	<?php while($query->have_posts()): $query->the_post();
                    global $post;
					buildark_bunch_setPostViews( get_the_ID() );
				?>
                <!--News Block-->
                <div class="news-style-one col-lg-4 col-md-6 col-sm-6 col-xs-12">
                    <div class="inner-box">
                        <div class="image">
                            <?php the_post_thumbnail( 'buildark_370x190', array( 'class' => 'img-responsive' ) );  ?>
                            <a href="<?php echo esc_url(get_permalink(get_the_id()));?>" class="overlay-link"></a>
                            <div class="post-date"><?php echo get_the_date('');?></div>
                        </div>
                        <div class="lower-box">
                            <h3><a href="<?php echo esc_url(get_permalink(get_the_id()));?>"><?php the_title(); ?></a></h3>
                            <div class="text"><?php echo wp_trim_words( get_the_content(), $text_limit );  ?></div>
                            <a href="<?php echo esc_url(get_permalink(get_the_id()));?>" class="read-more"><?php esc_html_e('Read more', 'buildark'); ?></a>
                        </div>
                    </div>
                </div>
                <?php endwhile; ?>
            </div>
            
            <!--Styled Pagination-->
            <div class="styled-pagination text-center">
                <?php buildark_the_pagination(array('total'=>$query->max_num_pages, 'next_text' => '<i class="fa fa-angle-right"></i>', 'prev_text' => '<i class="fa fa-angle-left"></i>')); ?>
            </div>
            <!--End Styled Pagination-->
            
        </div>
    </section>
    <!--End Blog Section-->
    
<?php endif; ?>

<?php wp_reset_postdata();