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

?>

<!--Welcome Section-->
<section class="welcome-section">
	<div class="auto-container">
	
		<?php if ( $query->have_posts() ) :  ?>
			
			<?php  if ( $title ) :  ?>
				<!--Sec Title-->
				<div class="sec-title centered">
					<h2><?php echo wp_kses_post( $title );  ?></h2>
				</div>
			<?php endif; ?>

			<div class="row clearfix">
					
				<?php 
					while($query->have_posts()): $query->the_post();
					 $services_meta = _WSH()->get_meta();
					 $flat_icon = buildark_set( $services_meta, 'fontawesome' );
					 $flat_icon = ( $flat_icon ) ? $flat_icon : 'flaticon-ruler';
					 $read_more_link = buildark_set( $services_meta, 'ext_url' );
					 global $post;
				?>

					<!--Services Block Two-->
					<div class="services-block-two col-md-4 col-sm-6 col-xs-12">
						<div class="inner-box">
							<div class="image">
								<a href="<?php echo esc_url( $read_more_link ); ?>">
									<?php 
										the_post_thumbnail( 'buildark_370x205', array( 'class' => 'img-responsive' ) )
									?>
								</a>
								<div class="icon-box"><span class="icon <?php echo esc_attr( $flat_icon );  ?>"></span></div>
							</div>
							<div class="lower-content">
								<h3><a href="<?php echo esc_url( $read_more_link ); ?>"><?php the_title(); ?></a></h3>
								<div class="text"><?php echo wp_trim_words( get_the_content(), $text_limit );  ?></div>
							</div>
						</div>
					</div>
					
				<?php endwhile; ?>

			</div>
			
		<?php endif; ?>
		
		<?php wp_reset_postdata(); ?>

		<!--Services List-->
		<section class="services-list-section">
			<div class="row clearfix">
			
				<?php if ( $services_icons ) :  ?>
				
					<?php foreach( $services_icons as $ser ) :   ?>

						<!--Services Block Three-->
						<div class="services-block-three col-lg-4 col-md-6 col-sm-6 col-xs-12">
							<div class="inner-box">
								<div class="image">
									<a href="<?php echo esc_url( $ser->service_link );  ?>">
										<img src="<?php echo esc_url( $ser->service_img );  ?>" alt="<?php esc_attr_e('image', 'buildark');?>" />
									</a>
								</div>
								<div class="content">
									<h3><a href="<?php echo esc_url( $ser->service_link );  ?>"><?php echo wp_kses_post( $ser->service_title );  ?></a></h3>
									<div class="text"><?php echo wp_kses_post( $ser->service_description );  ?></div>
									<a class="read-more" href="<?php echo esc_url( $ser->service_link );  ?>"><span class="arrow flaticon-right-arrow-1"></span> <?php esc_html_e( 'Read More', 'buildark' );  ?></a>
								</div>
							</div>
						</div>

					<?php endforeach; ?>
				
				<?php endif; ?>

			</div>
		</section>
		<!--Services List-->

	</div>
</section>
<!--End Welcome Section-->