Nenhuma Descrição

searchform.php 1.7KB

123456789101112131415161718192021222324252627282930313233
  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. * Generate a unique ID for each form and a string containing an aria-label
  15. * if one was passed to get_search_form() in the args array.
  16. */
  17. $twentytwenty_unique_id = twentytwenty_unique_id( 'search-form-' );
  18. $twentytwenty_aria_label = ! empty( $args['aria_label'] ) ? 'aria-label="' . esc_attr( $args['aria_label'] ) . '"' : '';
  19. // Backward compatibility, in case a child theme template uses a `label` argument.
  20. if ( empty( $twentytwenty_aria_label ) && ! empty( $args['label'] ) ) {
  21. $twentytwenty_aria_label = 'aria-label="' . esc_attr( $args['label'] ) . '"';
  22. }
  23. ?>
  24. <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( '/' ) ); ?>">
  25. <label for="<?php echo esc_attr( $twentytwenty_unique_id ); ?>">
  26. <span class="screen-reader-text"><?php _e( 'Search for:', 'twentytwenty' ); // phpcs:ignore: WordPress.Security.EscapeOutput.UnsafePrintingFunction -- core trusts translations ?></span>
  27. <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" />
  28. </label>
  29. <input type="submit" class="search-submit" value="<?php echo esc_attr_x( 'Search', 'submit button', 'twentytwenty' ); ?>" />
  30. </form>