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

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

    <!--News Section-->
	<section class="news-section">
    	<div class="auto-container">
        	<!--Sec Title-->
            <div class="sec-title centered">
            	<h2><?php  echo wp_kses_post( $title ); ?> </h2>
            </div>
            <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-md-4 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>
        </div>
    </section>
    <!--End News Section-->
    
<?php endif; ?>

<?php wp_reset_postdata(); ?>