-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsearchform.php
More file actions
58 lines (54 loc) · 1.46 KB
/
searchform.php
File metadata and controls
58 lines (54 loc) · 1.46 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
/**
* The template for displaying search form.
*
* @package Vite
*/
defined( 'ABSPATH' ) || exit;
$submit_icon = (bool) ( $args['submit_icon'] ?? false );
$context = $args['context'] ?? 'normal';
$icon_size = $args['icon_size'] ?? 24;
$core = vite( 'core' );
$in_mobile_menu_offset = $args['in_mobile_menu_offset'] ?? false;
if ( $in_mobile_menu_offset ) {
$context = 'normal';
}
$core->action( 'search-form/start' );
?>
<form
<?php
$core->print_html_attributes(
"search/$context",
[
'role' => 'search',
'method' => 'get',
'class' => [
'vite-search-form',
"vite-search-form--$context",
],
'action' => esc_url( home_url( '/' ) ),
]
);
?>
>
<label>
<span class="screen-reader-text"><?php echo esc_html__( 'Search for:', 'vite' ); ?></span>
<input type="search" class="vite-search-form__input" placeholder="<?php esc_html_e( 'Search …', 'vite' ); ?>" value="<?php echo esc_attr( get_search_query() ); ?>" name="s">
</label>
<button type="submit" class="vite-search-form__submit" aria-label="<?php echo esc_attr__( 'Search Submit', 'vite' ); ?>">
<span<?php echo esc_attr( $submit_icon ? ' class=screen-reader-text' : '' ); ?>><?php echo esc_html__( 'Search', 'vite' ); ?></span>
<?php
if ( $submit_icon ) {
vite( 'icon' )->get_icon(
'vite-search',
[
'echo' => true,
'size' => $icon_size,
]
);
}
?>
</button>
</form>
<?php
$core->action( 'search-form/end' );