<?php

/* Template Name: Explore */

?>


<?php get_header(); ?>
<?php 
$explore_pre_title = get_field('explore_pre_title');
$explore_heading = get_field('explore_heading');
$explore_page_links = get_field('explore_page_links');
$explore_background_image = get_field('explore_background_image');

// get_template_part('partials/template', 'hero'); 

?>



<?php if ($explore_background_image): ?>
	<style>
		.explore-block {
			background-image: url(<?php echo $explore_background_image['url']; ?>);
		}
	</style>
<?php endif; ?>

<section class="explore-block hero style-dark">
<div class="container">
	<div class="explore-block-inner hero-inner">
		<h1 class="small"><?php echo $explore_pre_title; ?></h1>
		<h2 class="h2"><?php echo $explore_heading; ?></h2>
	</div>
		<?php 
		// print_r($buttons);
		if ($explore_page_links): ?>

			<div class="explore-page-links-mobile hide-on-med-and-up">
				<h3>Explore...</h3>


	        	<?php // Check rows exists.
	        	if( have_rows('explore_page_links') ):

	        	    // Loop through rows.
	        	    while( have_rows('explore_page_links') ) : the_row();

	        	        // Load sub field value.
	        	        $title = get_sub_field('title');
	        	        $link = get_sub_field('link');
		    	        ?>					        	        
    	        		<?php if ($link): ?>
        	        		<a href="<?php echo $link['url']; ?>" target="<?php echo $link['target']; ?>" class="btn btn-color" ><?php echo $title; ?></a>
        	        	<?php endif;?>
	        	    <?php // End loop.
	        	    endwhile;

	        	// No value.
	        	else :
	        	    // Do something...
	        	endif;
	        	?>
			</div>

			<div class="explore-page-links-desktop hide-on-small-only">

		        	<?php // Check rows exists.
		        	if( have_rows('explore_page_links') ):

		        	    // Loop through rows.
		        	    while( have_rows('explore_page_links') ) : the_row();

		        	        // Load sub field value.
		        	        $title = get_sub_field('title');
		        	        $link = get_sub_field('link');
		        	        ?>
		        	        <div class="explore-box style-light">
		        	        
	        	        			<h4><?php echo $title; ?></h4>
		        	        		<?php if ($link): ?>
			        	        		<a href="<?php echo $link['url']; ?>" target="<?php echo $link['target']; ?>" class="btn btn-color hide-on-small-only" >Explore</a>
			        	        	<?php endif;?>
	        	        		
        	        		</div>
		        	    <?php // End loop.
		        	    endwhile;

		        	// No value.
		        	else :
		        	    // Do something...
		        	endif;
		        	?>

			</div>

		<?php endif; ?>
</div>
</section>


<?php

	get_template_part('partials/template', 'pagesections'); 
?>


<?php get_footer(); ?>
