<?php 
$attorneys_enable = get_theme_mod( 'advance_education_pro_radio_testimonial_enable' );
if ( 'Disable' == $attorneys_enable ) {
  return;
}
if( get_theme_mod('advance_education_pro_testimonial_bgcolor') ) { 
  $testi_backg = 'background-color:'.esc_attr(get_theme_mod('advance_education_pro_testimonial_bgcolor')).';';
}elseif( get_theme_mod('advance_education_pro_our_testimonial_bgimage') ){
  $testi_backg = 'background-image:url(\''.esc_url(get_theme_mod('advance_education_pro_our_testimonial_bgimage')).'\')';
}else{
  $testi_backg = '';   
}
$testimonial_excerpt="";
  if(get_theme_mod('advance_education_pro_excerpt_no',true)!=''){
    $testimonial_excerpt=get_theme_mod('advance_education_pro_excerpt_no',24);
  }
$att_style="";
  $image_att = get_theme_mod( 'advance_education_pro_our_testimonial_bgimage_attachment',true );
  if ( 'Scroll' == $image_att ) {
    $att_style="section_bg_scroll";
  }else{
    $att_style="section_bg_fixed";
  }  
?>

<section id="testimonials" style="<?php echo esc_html($testi_backg); ?>" class="<?php echo esc_attr($att_style)?>">
  <div class="innerbox">
    <div class="container"> 
      <?php if ( defined( 'ADVANCE_EDUCATION_PRO_POSTTYPE_VERSION' ) ) { ?>
      <div class="owl-carousel">
        <?php
          $args = array(
            'post_type' => 'testimonials',
            'post_status' => 'publish',
            'paged' => $paged,
          );
          $new = new WP_Query($args); 
          $loop_index = 0; $i=1;
          while ( $new->have_posts() ){
          $new->the_post();  ?>
          <div class="<?php if($i == 1){ echo 'active';}?>"> 
            <div class="row">
              <div class="testimonial_author_image col-lg-3 col-md-4 col-sm-3 col-12 m-0 p-0">
                <div class="testimonial_author">
                  <?php if (has_post_thumbnail()){ ?>
                    <img src="<?php the_post_thumbnail_url(); ?>">
                  <?php } ?>
                </div>
              </div>
              <div class="col-lg-9 col-md-8 col-sm-9 col-12 m-0 p-0">
                <div class="testimonial_box mb-3 col-md-10 offset-md-1" >
                  <div class="content_box w-100">
                    <div class="short_text"><blockquote><i class="<?php echo esc_html(get_theme_mod('advance_education_pro_our_testimonial_blockquote_icon')); ?>"></i><div class="blockquote-contents"><h4 class="testimonial_name"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> <cite><?php echo esc_html(get_post_meta($post->ID,'advance_education_pro_posttype_testimonial_desigstory',true)); ?></cite></h4><span class="contents"><?php $excerpt = get_the_excerpt(); echo esc_html(advance_education_pro_string_limit_words($excerpt,$testimonial_excerpt)); ?></span></div><i class="<?php echo esc_html(get_theme_mod('advance_education_pro_our_testimonial_blockquote_icon2')); ?>"></i></blockquote></div>
                  </div>                  
                </div>
              </div>
            </div>
          </div>
        <?php $i++; }
       wp_reset_query(); ?>
      </div>
    </div>
    <?php } else{ echo '<h5 class="text-center">' . esc_html__( 'Please Activate Advance Education Pro Posttype and create the testimonials to make it appear here.', 'advance-education-pro' ) . '</h5>'; } ?>
  </div>
</section>
