| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
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_Twenty_One 9 * @since Twenty Twenty-One 1.0 10 */ 11 12 /** 13 * @global WP_Query $wp_query WordPress Query object. 14 */ 15 global $wp_query; 16 17 get_header(); 18 19 if ( have_posts() ) { 20 ?> 21 <header class="page-header alignwide"> 22 <h1 class="page-title"> 23 <?php 24 printf( 25 /* translators: %s: Search term. */ 26 esc_html__( 'Results for "%s"', 'twentytwentyone' ), 27 '<span class="page-description search-term">' . esc_html( get_search_query( false ) ) . '</span>' 28 ); 29 ?> 30 </h1> 31 </header><!-- .page-header --> 32 33 <div class="search-result-count default-max-width"> 34 <?php 35 printf( 36 esc_html( 37 /* translators: %d: The number of search results. */ 38 _n( 39 'We found %d result for your search.', 40 'We found %d results for your search.', 41 (int) $wp_query->found_posts, 42 'twentytwentyone' 43 ) 44 ), 45 (int) $wp_query->found_posts 46 ); 47 ?> 48 </div><!-- .search-result-count --> 49 <?php 50 // Start the Loop. 51 while ( have_posts() ) { 52 the_post(); 53 54 /* 55 * Include the Post-Format-specific template for the content. 56 * If you want to override this in a child theme, then include a file 57 * called content-___.php (where ___ is the Post Format name) and that will be used instead. 58 */ 59 get_template_part( 'template-parts/content/content-excerpt', get_post_format() ); 60 } // End the loop. 61 62 // Previous/next page navigation. 63 twenty_twenty_one_the_posts_navigation(); 64 65 // If no content, include the "No posts found" template. 66 } else { 67 get_template_part( 'template-parts/content/content-none' ); 68 } 69 70 get_footer();
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated : Tue Oct 20 08:20:34 2026 | Cross-referenced by PHPXref |