<?php
/**
 * The main template file.
 *
 * @package thehoot
 */
 get_header(); ?>

 <div class="container">


 <div class="row">
   <div class="col">
     <?php

     $archive_title    = '';
     $archive_subtitle = '';

     if (is_search()) {
         global $wp_query;

         $archive_title = sprintf(
             '%1$s %2$s',
             '<span class="color-accent">' . __('Search:', 'thehoot') . '</span>',
             '&ldquo;' . get_search_query() . '&rdquo;'
         );

         if ($wp_query->found_posts) {
             $archive_subtitle = sprintf(
                 /* translators: %s: Number of search results */
                 _n(
                     'We found %s result for your search.',
                     'We found %s results for your search.',
                     $wp_query->found_posts,
                     'thehoot'
                 ),
                 number_format_i18n($wp_query->found_posts)
             );
         } else {
             $archive_subtitle = __('We could not find any results for your search. You can give it another try through the search form below.', 'thehoot');
         }
     } elseif (! is_home()) {
         $archive_title    = get_the_archive_title();
         $archive_subtitle = get_the_archive_description();
     }

     if ($archive_title || $archive_subtitle) {
         ?>

   		<header class="archive-header">

   			<div class="archive-header-inner">

   				<?php if ($archive_title) {
             ?>
   					<h1 class="archive-title"><?php echo wp_kses_post($archive_title); ?></h1>
   				<?php
         } ?>

   				<?php if ($archive_subtitle) {
             ?>
   					<div class="archive-subtitle section-inner thin max-percentage intro-text"><?php echo wp_kses_post(wpautop($archive_subtitle)); ?></div>
   				<?php
         } ?>

   			</div><!-- .archive-header-inner -->

   		</header><!-- .archive-header -->

      <div class="row results" data-aos="animate-up" data-aos-delay="150">



   		<?php
     }

     if (have_posts()) {
         $i = 0;

         while (have_posts()) {
             $i++;

             the_post();

             get_template_part('template-parts/content', get_post_type());

         } ?>

               </div>

<?php  } elseif (is_search()) {
         ?>

   		<div class="no-search-results-form section-inner thin">

   			<?php
             get_search_form(
                 array(
                     'label' => __('search again', 'thehoot'),
                 )
             ); ?>

   		</div><!-- .no-search-results -->

   		<?php
     }
     ?>

   	<?php get_template_part('template-parts/pagination'); ?>
   </div>
   <!-- /.col -->
 <?php if (is_active_sidebar('sidebar-posts')) : ?>
   <div class="col-md-3 sidebar">
     <?php if (is_active_sidebar('sidebar-posts')) : ?>
     <div id="secondary" class="widget-area" role="complementary">
       <?php dynamic_sidebar('sidebar-posts'); ?>
     </div>
     <?php endif; ?>
   </div>
   <!-- /.col-md-3 sidebar -->
   <?php endif; ?>
 </div>
 <!-- /.row -->
</div>  <!-- /.container -->

  <?php get_footer(); ?>
