[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-content/themes/twentysixteen/ -> search.php (source)

   1  <?php
   2  /**
   3   * The template for displaying search results pages
   4   *
   5   * @package WordPress
   6   * @subpackage Twenty_Sixteen
   7   * @since Twenty Sixteen 1.0
   8   */
   9  
  10  get_header(); ?>
  11  
  12      <section id="primary" class="content-area">
  13          <main id="main" class="site-main">
  14  
  15          <?php if ( have_posts() ) : ?>
  16  
  17              <header class="page-header">
  18                  <h1 class="page-title">
  19                  <?php
  20                  /* translators: %s: The search query. */
  21                  printf( __( 'Search Results for: %s', 'twentysixteen' ), '<span>' . esc_html( get_search_query() ) . '</span>' );
  22                  ?>
  23                  </h1>
  24              </header><!-- .page-header -->
  25  
  26              <?php
  27              // Start the loop.
  28              while ( have_posts() ) :
  29                  the_post();
  30  
  31                  /**
  32                   * Run the loop for the search to output the results.
  33                   * If you want to overload this in a child theme then include a file
  34                   * called content-search.php and that will be used instead.
  35                   */
  36                  get_template_part( 'template-parts/content', 'search' );
  37  
  38                  // End the loop.
  39              endwhile;
  40  
  41              // Previous/next page navigation.
  42              the_posts_pagination(
  43                  array(
  44                      'prev_text'          => __( 'Previous page', 'twentysixteen' ),
  45                      'next_text'          => __( 'Next page', 'twentysixteen' ),
  46                      /* translators: Hidden accessibility text. */
  47                      'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'twentysixteen' ) . ' </span>',
  48                  )
  49              );
  50  
  51              // If no content, include the "No posts found" template.
  52          else :
  53              get_template_part( 'template-parts/content', 'none' );
  54  
  55          endif;
  56          ?>
  57  
  58          </main><!-- .site-main -->
  59      </section><!-- .content-area -->
  60  
  61  <?php get_sidebar(); ?>
  62  <?php get_footer(); ?>


Generated : Fri Apr 26 08:20:02 2024 Cross-referenced by PHPXref