[ Index ] |
PHP Cross Reference of WordPress |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * The searchform.php template. 4 * 5 * Used any time that get_search_form() is called. 6 * 7 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/ 8 * 9 * @package WordPress 10 * @subpackage Twenty_Twenty 11 * @since Twenty Twenty 1.0 12 */ 13 14 /* 15 * Generate a unique ID for each form and a string containing an aria-label 16 * if one was passed to get_search_form() in the args array. 17 */ 18 $twentytwenty_unique_id = twentytwenty_unique_id( 'search-form-' ); 19 20 $twentytwenty_aria_label = ! empty( $args['aria_label'] ) ? 'aria-label="' . esc_attr( $args['aria_label'] ) . '"' : ''; 21 // Backward compatibility, in case a child theme template uses a `label` argument. 22 if ( empty( $twentytwenty_aria_label ) && ! empty( $args['label'] ) ) { 23 $twentytwenty_aria_label = 'aria-label="' . esc_attr( $args['label'] ) . '"'; 24 } 25 ?> 26 <form role="search" <?php echo $twentytwenty_aria_label; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped above. ?> method="get" class="search-form" action="<?php echo esc_url( home_url( '/' ) ); ?>"> 27 <label for="<?php echo esc_attr( $twentytwenty_unique_id ); ?>"> 28 <span class="screen-reader-text"><?php _e( 'Search for:', 'twentytwenty' ); // phpcs:ignore: WordPress.Security.EscapeOutput.UnsafePrintingFunction -- core trusts translations ?></span> 29 <input type="search" id="<?php echo esc_attr( $twentytwenty_unique_id ); ?>" class="search-field" placeholder="<?php echo esc_attr_x( 'Search …', 'placeholder', 'twentytwenty' ); ?>" value="<?php echo get_search_query(); ?>" name="s" /> 30 </label> 31 <input type="submit" class="search-submit" value="<?php echo esc_attr_x( 'Search', 'submit button', 'twentytwenty' ); ?>" /> 32 </form>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Mon Oct 7 01:00:03 2024 | Cross-referenced by PHPXref 0.7.1 |