[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-content/themes/twentytwentyone/ -> searchform.php (source)

   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/reference/functions/wp_unique_id/
   8   * @link https://developer.wordpress.org/reference/functions/get_search_form/
   9   *
  10   * @package WordPress
  11   * @subpackage Twenty_Twenty_One
  12   * @since Twenty Twenty-One 1.0
  13   */
  14  
  15  /*
  16   * Generate a unique ID for each form and a string containing an aria-label
  17   * if one was passed to get_search_form() in the args array.
  18   */
  19  $twentytwentyone_unique_id = wp_unique_id( 'search-form-' );
  20  
  21  $twentytwentyone_aria_label = ! empty( $args['aria_label'] ) ? 'aria-label="' . esc_attr( $args['aria_label'] ) . '"' : '';
  22  ?>
  23  <form role="search" <?php echo $twentytwentyone_aria_label; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped above. ?> method="get" class="search-form" action="<?php echo esc_url( home_url( '/' ) ); ?>">
  24      <label for="<?php echo esc_attr( $twentytwentyone_unique_id ); ?>"><?php _e( 'Search&hellip;', 'twentytwentyone' ); // phpcs:ignore: WordPress.Security.EscapeOutput.UnsafePrintingFunction -- core trusts translations ?></label>
  25      <input type="search" id="<?php echo esc_attr( $twentytwentyone_unique_id ); ?>" class="search-field" value="<?php echo get_search_query(); ?>" name="s" />
  26      <input type="submit" class="search-submit" value="<?php echo esc_attr_x( 'Search', 'submit button', 'twentytwentyone' ); ?>" />
  27  </form>


Generated : Sat Nov 23 08:20:01 2024 Cross-referenced by PHPXref