<?php if (have_posts()): while (have_posts()) : the_post(); ?>
<div>
	<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
		<div class="uk-card uk-card-default uk-card-body uk-box-shadow team-members uk-padding-remove uk-text-center">
				<?php if ( has_post_thumbnail() ) { ?>
					<div>
						<?php 
						$link = get_field('booking_link');
						if( $link ){ ?>
							<a href="<?php echo esc_url( $link ); ?>" target="_blank"><img uk-img data-src="<?php the_post_thumbnail_url('thumbnail'); ?>" data-width data-height></a>
						<?php } else { ?>
							<img uk-img data-src="<?php the_post_thumbnail_url('thumbnail'); ?>" data-width data-height>
						<?php }  ?>
					</div>
				<?php } else { ?>
				<?php } ?>
			<div class="uk-padding">
				<h2><?php the_title(); ?></h2>
				<p class="green"><?= get_field('job_title'); ?></p>
				<p><i>Enjoys Working with:</i></p>
				<?php

				// Check rows exists.
				if( have_rows('enjoys_working_with:') ): ?>
				
				<ul class="uk-text-left">
				
					<?php // Loop through rows.
					while( have_rows('enjoys_working_with:') ) : the_row(); ?>


						<li class="orange"><?= get_sub_field('item'); ?></li>


					<?php // End loop.
					endwhile; ?>
					
				</ul>

				<?php // No value.
				else :
					// Do something...
				endif; ?>
				<p class="orange"><?= get_field('counsellor_note'); ?></p>
				<p><?= get_field('counsellor_short_description'); ?></p>
				<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" class="uk-button uk-button-primary">Read More</a>
			</div>
		</div>
	</article>		
</div>			

<?php endwhile; ?>

<?php else: ?>
	<article>
		<h2><?php _e( 'Sorry, nothing to display.', 'html5blank' ); ?></h2>
	</article>
<?php endif; ?>
