<?php
/**
 * Template Name: Location Template
 * Template Post Type: page
 *
 * @package thehoot
 */


get_header(); ?>

  <div id="primary" class="cs-content-area">

    <?php
	$location_title = get_field('location_title');
	$location_content = get_field('location_detail');
	if ($location_title) : ?>

      <h1><?php echo esc_html($location_title); ?></h1>

      <?php endif; ?>
        <?php
if ($location_content) : ?>
        <?php echo wp_kses_post ($location_content); ?>
        <?php endif; ?>

  </div>

  <aside id="secondary" class="cs-sidebar__area cs-widget-area">
    <div class="cs-sidebar__inner">
      <h5 class="cs-section-heading cnvs-block-section-heading is-style-cnvs-block-section-heading-default halignleft  ">
				<span class="cnvs-section-title"><span>Articles you might like</span></span></h5>
    </div>

    <section>
      <?php
							$cat = get_field('choose_your_category');
							$query = new WP_Query( array(
								'cat' => $cat,
								'posts_per_page' => 6,
								) );

							while ( $query->have_posts() ) : $query->the_post();

							?>

        <article class="mt-5">

          <a href="<?php the_permalink (); ?>" class="w-100 h-100">

            <?php if (has_post_thumbnail()) : ?>
              <?php the_post_thumbnail('full', array( 'class' => 'img-fluid w-100' )) ?>

                <?php endif;  ?>

          </a>

          <div class="flex justify-between mt-5">
            <h2 class="h5">
													<a href="<?php the_permalink (); ?>">

											<?php the_title(); ?>

													</a>
												</h2>
            <p class="flex-shrink-1 mt-2 text-lg sm:text-xl text-gray aos-init aos-animate" data-aos="animate-up">

              <?php the_date(); ?>

            </p>
          </div>
        </article>

        <?php endwhile;

									wp_reset_postdata()

									?>

    </section>





  </aside>


  <?php get_footer(); ?>
