<?php 
	$args = array('post_type' => 'team', 'posts_per_page' => -1, 'order' => 'ASC' );
	$loop = new WP_Query( $args );
?>

<?php if ($loop->have_posts()): ?>
	<div class="team-wrapper row" data-equalizer>
		<div class="col-md-6">
			<h2 class="h1 bold">Our Team</h2>
			<h3 style="max-width:85%;">A strong team spiritng and proactive duty of care is what sets our dedicated team of electricians apart. It's the very reason we show up to every job wiht a smile and a 'can do' attitude.</h3>
		</div>
		<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
			<?php 
				$title = get_the_title(); 
				$position = get_field('position');
				$email = get_field('email');
				$picture = get_field('profile_picture');
			?>
			<div class="col-md-3 team">
				<?php if ($picture) { ?>
					<img src="<?php echo $picture; ?>" alt="<?php echo $title; ?>">
				<?php } else { ?>
					<img src="http://placehold.it/370x300" alt="">
				<?php } ?>
				<h3><?php echo $title; ?> + <?php echo $position; ?></h3>
				<p><a href="mailto:<?php echo $email; ?>"><?php echo $email; ?></a></p>
			</div>
		<?php endwhile; ?>
		<?php wp_reset_postdata(); ?>
	</div>
<?php endif ?>