<?php

// Prevent Direct Access
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

$team_suptitle = get_theme_mod('team_suptitle');
$team_title = get_theme_mod('team_title');
$section_id = get_theme_mod('team_menu_id', 'team');
?>

<section class="padding" id="<?php echo $section_id ?>">
	<div class="container ivy-team">
		<div class="row">

			<?php if( $team_title != '' || $team_suptitle != '' ){ ?>
			<div class="col-sm-12 text-center title_block heading_space">
				<?php
				if( $team_suptitle != '' ){ echo '<p class="title bottom0">'.$team_suptitle.'</p>'; }
				if( $team_title != '' ){ echo '<h2 class="darkcolor">'.$team_title.'</h2>'; }
				?>
			</div>
			<?php } ?>
			
			<?php
			$team = new WP_Query(array(
				'post_type' => 'team',
				'posts_per_page' => -1
			));

			if( $team -> have_posts() ){
			?>
			
			<div class="col-sm-12">
				<div class="ivy-team">
					<div class="swiper-container">
						<div class="swiper-wrapper">
							
							<?php
							while( $team -> have_posts() ){
								$team -> the_post();
							?>

							<div class="swiper-slide ourteam">
							
								<div class="image">
								
									<?php
									$team_member_socials = rwmb_meta('team_member_socials');
									if( $team_member_socials ){
									?>
									<ul class="social_vertical">
										<?php
										foreach($team_member_socials as $social){
											echo '<li><a href="'.$social['link'].'"><i class="'.$social['icon'].'"></i></a></li>';
										}
										?>
									</ul>
									<?php } ?>
									
									<?php the_post_thumbnail('team') ?>
									
								</div>
								
								<div class="team_caption darkcolor">
									<div class="overlay"></div>
									
									<?php
									$team_member_name = get_the_title();
									$team_member_position = rwmb_meta('team_member_position');

									if( $team_member_name != '' ){
										echo '<h3 class="bottom10">'.$team_member_name.'</h3>';
									}

									if( $team_member_position != '' ){
										echo '<p class="darkcolor">'.$team_member_position.'</p>';
									}
									?>
									
								</div>
								
							</div>

							<?php } ?>

						</div>
					</div>
				</div>
				<div class="text-center">
					<div class="swiper-pagination top40"></div>
				</div>
			</div>
			
			<?php
			}

			wp_reset_postdata();
			?>
			
		</div>
	</div>
</section>