[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-content/themes/twentytwenty/ -> 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/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">
  29              <?php
  30              /* translators: Hidden accessibility text. */
  31              _e( 'Search for:', 'twentytwenty' ); // phpcs:ignore: WordPress.Security.EscapeOutput.UnsafePrintingFunction -- core trusts translations
  32              ?>
  33          </span>
  34          <input type="search" id="<?php echo esc_attr( $twentytwenty_unique_id ); ?>" class="search-field" placeholder="<?php echo esc_attr_x( 'Search &hellip;', 'placeholder', 'twentytwenty' ); ?>" value="<?php echo get_search_query(); ?>" name="s" />
  35      </label>
  36      <input type="submit" class="search-submit" value="<?php echo esc_attr_x( 'Search', 'submit button', 'twentytwenty' ); ?>" />
  37  </form>


Generated : Thu Nov 21 08:20:01 2024 Cross-referenced by PHPXref