<?php
/**
 * Search results.
 */
get_header();
?>
<header class="mp-page-hero">
  <div class="mp-page-hero-inner">
    <div class="mp-page-eyebrow"><?php esc_html_e( 'Search Results', 'merchantpro' ); ?></div>
    <h1 class="page-title">"<?php echo esc_html( get_search_query() ); ?>"</h1>
    <p class="page-sub">
      <?php
      global $wp_query;
      printf(
        /* translators: %d: count */
        esc_html( _n( '%d result found', '%d results found', $wp_query->found_posts, 'merchantpro' ) ),
        (int) $wp_query->found_posts
      );
      ?>
    </p>
  </div>
</header>

<section class="mp-archive">
  <div class="mp-archive-inner">
    <?php if ( have_posts() ) : ?>
      <?php while ( have_posts() ) : the_post(); ?>
        <article class="mp-post-card">
          <div class="mp-post-meta"><?php echo esc_html( ucfirst( get_post_type() ) ); ?></div>
          <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
          <?php the_excerpt(); ?>
        </article>
      <?php endwhile; ?>
    <?php else : ?>
      <article class="mp-post-card">
        <h2><?php esc_html_e( 'No results.', 'merchantpro' ); ?></h2>
        <p><?php esc_html_e( 'Try different keywords or call us directly at 410-573-1133.', 'merchantpro' ); ?></p>
        <p><?php get_search_form(); ?></p>
      </article>
    <?php endif; ?>
  </div>
</section>

<?php get_footer(); ?>
