<?php 
$team_enable = get_theme_mod( 'advance_education_pro_radio_our_team_enable' );
if ( 'Disable' == $team_enable ) {
  return;
}
/*team*/
if( get_theme_mod('advance_education_pro_our_team_bgcolor') ) { 
  $about_backg = 'background-color:'.esc_attr(get_theme_mod('advance_education_pro_our_team_bgcolor')).';';
}elseif( get_theme_mod('advance_education_pro_our_team_bgimage') ){
  $about_backg = 'background-image:url(\''.esc_url(get_theme_mod('advance_education_pro_our_team_bgimage')).'\')';
}else{
  $about_backg = '';   
}
$args = array(
  'post_type' => 'team',
  'post_status' => 'publish'
);
  $att_style="";
  $image_att = get_theme_mod( 'advance_education_pro_our_team_bgimage_attachment',true );
  if ( 'Scroll' == $image_att ) {
    $att_style="section_bg_scroll";
  }else{
    $att_style="section_bg_fixed";
  }              
$new = new WP_Query($args); 
if ( defined( 'ADVANCE_EDUCATION_PRO_POSTTYPE_VERSION' ) ) :
?>
  <section id="our_teachers" style="<?php echo esc_html($about_backg); ?>" class="<?php echo esc_attr($att_style); ?>">
    <div class="container">
    <?php if(get_theme_mod('advance_education_pro_team_title') != '' || get_theme_mod('advance_education_pro_team_subtitle')){?>
      <div class="section-heading">
        <h3> 
          <?php if(get_theme_mod('advance_education_pro_title_icon')){
              ?> <i class="<?php echo esc_html(get_theme_mod('advance_education_pro_title_icon')) ?>"></i><?php
            }?>
          <?php echo esc_html(get_theme_mod('advance_education_pro_team_title')); ?></h3>
        <p><?php echo esc_html(get_theme_mod('advance_education_pro_team_subtitle')); ?></p>
      </div>
    <?php } ?>
    <?php if ( $new->have_posts() ) : ?>
      <div class="owl-carousel">
        <?php            
          $loop_index = 0; $i=1;
          while ( $new->have_posts() ){
          $new->the_post();  ?>
          <div class="<?php if($i == 1){ echo 'active';}?>"> 
            <div class="box">
               <div class="image-box media">
                <?php the_post_thumbnail(); ?>
                <div class="overlay">
                   <div class="box-content"> 
                     <h5 class="teamtitle"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h5>
                      <h4 class="border_heading"><?php echo esc_html(get_post_meta($post->ID,'team_designation',true)); ?></h4>  
                      <p><?php $excerpt = get_the_excerpt();
                         echo esc_html(advance_education_pro_string_limit_words($excerpt,25));?></p> 
                      <div class="socialbox">                       
                        <?php if(get_post_meta($post->ID,'meta-facebookurl',true) || get_post_meta($post->ID,'meta-twitterurl',true) || get_post_meta($post->ID,'meta-googleplusurl',true) || get_post_meta($post->ID,'meta-linkdenurl',true)){?>
                            <?php if(get_post_meta($post->ID,'meta-facebookurl',true)){?>
                              <a class="" href="<?php echo esc_html(get_post_meta($post->ID,'meta-facebookurl',true)); ?>" target="_blank"><i class="fab fa-facebook-f"></i></a>
                            <?php } if(get_post_meta($post->ID,'meta-twitterurl',true)){?>
                              <a class="" href="<?php echo esc_html(get_post_meta($post->ID,'meta-twitterurl',true)); ?>" target="_blank"><i class="fab fa-twitter"></i></a>                              
                            <?php } if(get_post_meta($post->ID,'meta-linkdenurl',true)){?>
                              <a class="" href="<?php echo esc_html(get_post_meta($post->ID,'meta-linkdenurl',true)); ?>" target="_blank"><i class="fab fa-linkedin-in"></i></a>
                            <?php } if(get_post_meta($post->ID,'meta-googleplusurl',true)){?>
                              <a class="" href="<?php echo esc_html(get_post_meta($post->ID,'meta-googleplusurl',true)); ?>" target="_blank"><i class="fab fa-google-plus-g"></i></a>
                            <?php }?>
                        <?php }?>
                      </div>
                  </div>
                </div>
            </div>
          </div>
          </div>
        <?php $i++; }
        wp_reset_query(); ?>
      </div>
      <?php
        else :
          echo '<h5 class="text-center">' . esc_html__( 'Create the team to make it appear here.', 'advance-education-pro' ) . '</h5>'; 
        endif;
      ?>
    </div>
    <div class="clearfix"></div>
  </section>
<?php
else :
  echo '<h5 class="text-center">' . esc_html__( 'Please Activate Advance Education Pro Posttype and create Our Teachers to make it appear here.', 'advance-education-pro' ) . '</h5>'; 
endif; ?>
