-
Notifications
You must be signed in to change notification settings - Fork 0
/
searchform.php
executable file
·26 lines (24 loc) · 1.36 KB
/
searchform.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
/**
* The searchform.php template.
*
* Used any time that get_search_form() is called.
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*/
/*
* Generate a unique ID for each form and a string containing an aria-label if
* one was passed to get_search_form() in the args array.
*/
$unique_id = GT_Tags::unique_id( 'search-form-' );
$aria_label = ! empty( $args['label'] ) ? 'aria-label="' . esc_attr( $args['label'] ) . '"' : '';
?>
<form role="search" <?php echo $aria_label; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped above. ?> method="get" class="search-form" action="<?php echo esc_url( home_url( '/' ) ); ?>">
<div class="input-group">
<label class="screen-reader-text" for="<?php echo esc_attr( $unique_id ); ?>"><?php _e( 'Search for:', 'gcode-theme' ); // phpcs:ignore: WordPress.Security.EscapeOutput.UnsafePrintingFunction -- core trusts translations ?></label>
<input type="search" id="<?php echo esc_attr( $unique_id ); ?>" class="search-field input-group-field" placeholder="<?php echo esc_attr_x( 'Search …', 'placeholder', 'gcode-theme' ); ?>" value="<?php echo get_search_query(); ?>" name="s" />
<div class="input-group-button">
<input type="submit" class="search-submit button" value="<?php echo esc_attr_x( 'Search', 'submit button', 'gcode-theme' ); ?>" />
</div>
</div>
</form>