<?php
/**
 * Expert Section
 * 
 * @package relax_spa
 */
if( class_exists( 'The_Bootstrap_Themes_Companion' ) ) {
if( get_theme_mod( 'bs_testimonial_display_option', true ) ) :
  $bs_heading_for_testimonial     = get_theme_mod( 'bs_heading_for_testimonial' );
  $bs_top_heading_for_testimonial  = get_theme_mod( 'bs_top_heading_for_testimonial' );
  $bs_image_for_testimonial       = get_theme_mod( 'bs_image_for_testimonial' );
?> 
<section class="home-section testimonial" style="background-image: url(<?php echo esc_url($bs_image_for_testimonial); ?>);" id="relax_spa_testimonial_sections">
    <div class="container">
      <div class="testimonial-block">
      <?php if($bs_top_heading_for_testimonial OR $bs_heading_for_testimonial ){ ?>
      <div class="main-title">
        <?php if($bs_top_heading_for_testimonial){ ?>
          <span class="sub-title"><?php echo esc_html($bs_top_heading_for_testimonial); ?></span>
          <?php } if($bs_heading_for_testimonial){ ?>
          <h2 class="title"><?php echo esc_html($bs_heading_for_testimonial); ?></h2>
        <?php } ?>
      </div>       
      <?php } ?>  
        <div class="testimonial-wrapper owl-carousel">
        <?php
          $args = array(
            'post_type' => 'tbtc_testimonials',
            'post_status'    => 'publish',
            'posts_per_page' => -1
            );
          $loop = new WP_Query( $args );
          global $post, $wp_query;
     
          if ( $loop->have_posts() ) {
          while ( $loop->have_posts() ) : $loop->the_post();
          $postID = get_the_ID();
          $custom = get_post_custom(get_the_ID());

          if (!empty($custom)){
              if(isset($custom['tbtc_designation'])){
                  $tbtc_designation = $custom['tbtc_designation'][0];
              }
          }        
        ?>
          <div class="testimonial-holder">
            <span class="icon-quote-left"></span>
             <?php the_content(); ?>
            <?php
            if (has_post_thumbnail()) {
              $testimonial_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'medium');
          ?>
            <div class="img-holder">
              <img src="<?php echo esc_url( $testimonial_image[0] ); ?>">
            </div>
          <?php } ?>
            <span class="testimonial-title"><?php the_title(); ?></span>
            <?php if($tbtc_designation){ ?>
            <span class="organization"><?php echo esc_html($tbtc_designation); ?></span>
            <?php } ?>
          </div>
          <?php
            endwhile;
          } else {
            esc_html_e('No data found','relax-spa');
          }
          wp_reset_postdata();
        ?>  
        </div>
      </div>
    </div>
</section>
<?php endif; }