<?php 
$query_args = array('post_type' => 'sh_testimonials' , 'showposts' => $num , 'order_by' => $sort , 'order' => $order);

if( $cat ) $query_args['testimonials_category'] = $cat;

$tabs = array();
$post_data = '';
$query = new WP_Query($query_args) ;?>
					
					<?php ob_start();

					while($query->have_posts()): $query->the_post(); 

						$limit = ( $excerpt ) ? $excerpt : 20;
						$meta = _WSH()->get_meta();?>
					
						<?php $active = ( $query->current_post == 0 ) ? ' class="active"' : '';
						$active1 = ( $query->current_post == 0 ) ? ' in active' : '';
						$tabs[get_the_id()] = '
													<li'.$active.'>
														<a href="#client'.get_the_id().'" aria-controls="client'.get_the_id().'" role="tab" data-toggle="tab">
															'.get_the_post_thumbnail(get_the_id(), 'thumbnail').'
														</a>
													</li>
						'; ?>

									<div class="tab-pane fade<?php echo esc_attr( $active1 ); ?>" id="client<?php the_ID(); ?>">
										<p>
											<?php echo _sh_trim( get_the_content(), $limit); ?>
										</p>
										<h4 class="uppercase"><?php the_title(); ?></h4>
										<span><?php echo balanceTags(sh_set( $meta, 'designation')); ?></span>
									</div><!-- / .tab-pane -->
					
					<?php endwhile; 

wp_reset_postdata();
$post_data = ob_get_clean();

ob_start();?>

				<div class="padding">

					<?php  if( $title ): ?>
						<header class="header-section wow fadeInDown" data-wow-duration="1.5s">
							<h2><?php echo balanceTags($title); ?></h2>
						</header> <!-- / .header-section -->
					<?php endif; ?>

					

					<div class="row">
						<div class="col-md-8 col-md-offset-2">

							<div class="clients wow fadeIn">

								<!-- Nav tabs -->
								<ul class="clients-tabs" role="tablist">
									<?php echo implode("\n", (array)$tabs) ?>
								</ul>

								<!-- Tab panes -->
								<div class="tab-content clients-content">
									<?php echo balanceTags($post_data); ?>
								</div><!-- / .clients-content -->

							</div><!-- / .clients -->

						</div> <!-- / .col-md-8 -->
					</div> <!-- / .row -->
				</div>

<?php return ob_get_clean();