<?php get_header(); ?>

<div class="uk-margin-large uk-container" uk-scrollspy="cls: uk-animation-fade; delay: 200">

	<main role="main">
			<section>

			<?php if (have_posts()): while (have_posts()) : the_post(); ?>

				<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
					<h1 class="uk-margin-remove-bottom"><?php the_title(); ?></h1>
					<h3 class="green uk-margin-remove-top"><?= get_field('job_title'); ?></h3>
					<div class="uk-child-width-1-2@m" uk-grid>
						<div>




							<?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>
						<div>
							<h3><i>Enjoys Working with:</i></h3>
							<?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; ?>
							<div class="orange"><?= get_field('counsellor_note'); ?></div>
						</div>
					</div>

					<?php the_content(); ?>

					<p class="uk-text-center uk-margin-large-top"><a href="<?= home_url(); ?>/counsellors/" title="All Counsellors" class="uk-button uk-button-primary">Back to All Counsellors</a></p>



					<br class="clear">

					<?php edit_post_link( __('Edit this page'), '', '', 0, 'post-edit-link uk-label uk-float-right' ); ?>

				</article>

			<?php endwhile; ?><?php endif; ?>

			</section>
	</main>

</div>
<?php get_footer(); ?>
