[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

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

   1  <?php
   2  /**
   3   * The template for displaying search results pages
   4   *
   5   * @link https://developer.wordpress.org/themes/basics/template-hierarchy/#search-result
   6   *
   7   * @package WordPress
   8   * @subpackage Twenty_Seventeen
   9   * @since Twenty Seventeen 1.0
  10   * @version 1.0
  11   */
  12  
  13  get_header(); ?>
  14  
  15  <div class="wrap">
  16  
  17      <header class="page-header">
  18          <?php if ( have_posts() ) : ?>
  19              <h1 class="page-title">
  20              <?php
  21              /* translators: Search query. */
  22              printf( __( 'Search Results for: %s', 'twentyseventeen' ), '<span>' . get_search_query() . '</span>' );
  23              ?>
  24              </h1>
  25          <?php else : ?>
  26              <h1 class="page-title"><?php _e( 'Nothing Found', 'twentyseventeen' ); ?></h1>
  27          <?php endif; ?>
  28      </header><!-- .page-header -->
  29  
  30      <div id="primary" class="content-area">
  31          <main id="main" class="site-main">
  32  
  33          <?php
  34          if ( have_posts() ) :
  35              // Start the Loop.
  36              while ( have_posts() ) :
  37                  the_post();
  38  
  39                  /**
  40                   * Run the loop for the search to output the results.
  41                   * If you want to overload this in a child theme then include a file
  42                   * called content-search.php and that will be used instead.
  43                   */
  44                  get_template_part( 'template-parts/post/content', 'excerpt' );
  45  
  46              endwhile; // End the loop.
  47  
  48              the_posts_pagination(
  49                  array(
  50                      /* translators: Hidden accessibility text. */
  51                      'prev_text'          => twentyseventeen_get_svg( array( 'icon' => 'arrow-left' ) ) . '<span class="screen-reader-text">' . __( 'Previous page', 'twentyseventeen' ) . '</span>',
  52                      /* translators: Hidden accessibility text. */
  53                      'next_text'          => '<span class="screen-reader-text">' . __( 'Next page', 'twentyseventeen' ) . '</span>' . twentyseventeen_get_svg( array( 'icon' => 'arrow-right' ) ),
  54                      /* translators: Hidden accessibility text. */
  55                      'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'twentyseventeen' ) . ' </span>',
  56                  )
  57              );
  58  
  59          else :
  60              ?>
  61  
  62              <p><?php _e( 'Sorry, but nothing matched your search terms. Please try again with some different keywords.', 'twentyseventeen' ); ?></p>
  63              <?php
  64                  get_search_form();
  65  
  66          endif;
  67          ?>
  68  
  69          </main><!-- #main -->
  70      </div><!-- #primary -->
  71      <?php get_sidebar(); ?>
  72  </div><!-- .wrap -->
  73  
  74  <?php
  75  get_footer();


Generated : Sat Dec 21 08:20:01 2024 Cross-referenced by PHPXref