-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsearchform.php
More file actions
39 lines (36 loc) · 1.83 KB
/
searchform.php
File metadata and controls
39 lines (36 loc) · 1.83 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
<?php
/**
* The searchform.php template.
*
* Used any time that get_search_form() is called.
*
* @link https://developer.wordpress.org/reference/functions/wp_unique_id/
* @link https://developer.wordpress.org/reference/functions/get_search_form/
*/
/*
* 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.
*/
$soyes_aria_label = !empty($args['aria_label']) ? 'aria-label="' . esc_attr($args['aria_label']) . '"' : '';
$count_posts = wp_count_posts();
?>
<div class="entry-search">
<form role="search" <?php echo $soyes_aria_label; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped above. ?>
method="get" class="search-form" action="<?php echo esc_url(home_url('/')); ?>">
<div class="search-input-container">
<img src="<?php echo soyes_get_the_image('search-outline', 'svg', true, false); ?>" width="15"
height="15"
alt="🔎"
aria-hidden="true" class="search-icon"/>
<input type="search"
required
placeholder="<?php printf(/* translators: %d: Number of posts. */
esc_html__('Search among %d posts...', 'soyes'), $count_posts->publish); ?>"
class="search-input"
aria-label="<?php _e('Search…', 'soyes'); // phpcs:ignore: WordPress.Security.EscapeOutput.UnsafePrintingFunction -- core trusts translations ?>"
value="<?php echo get_search_query(); ?>" name="s"/>
</div><!-- .search-input-container -->
<input type="submit" class="wp-block-button__link search-button"
value="<?php echo esc_attr_x('🔍 Search', 'submit button', 'soyes'); ?>"/>
</form><!-- .search-form -->
</div><!-- .entry-search -->