-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsearchform.php
87 lines (63 loc) · 2.28 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
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
/**
* Search form
*
* @copyright 2019-present Creative Themes
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
*/
$placeholder = esc_attr_x('Search', 'placeholder', 'blocksy');
if (isset($args['search_placeholder'])) {
$placeholder = $args['search_placeholder'];
}
if (isset($args['search_live_results'])) {
$has_live_results = $args['search_live_results'];
} else {
$has_live_results = get_theme_mod('search_enable_live_results', 'yes');
}
$search_live_results_output = '';
if ($has_live_results === 'yes') {
if (! isset($args['live_results_attr'])) {
$args['live_results_attr'] = 'thumbs';
}
$search_live_results_output = 'data-live-results="' . $args['live_results_attr'] . '"';
}
$class_output = '';
$any = [];
if (
isset($args['ct_post_type'])
&&
$args['ct_post_type']
) {
$any = $args['ct_post_type'];
}
if (
isset($args['enable_search_field_class'])
&&
$args['enable_search_field_class']
) {
$class_output = 'class="modal-field"';
}
$home_url = home_url('');
if (function_exists('pll_home_url')) {
$home_url = pll_home_url();
}
?>
<form
role="search" method="get"
class="search-form"
action="<?php echo esc_url($home_url); ?>"
<?php echo wp_kses_post($search_live_results_output) ?>>
<input type="search" <?php echo $class_output ?> placeholder="<?php echo $placeholder; ?>" value="<?php echo get_search_query(); ?>" name="s" autocomplete="off" title="<?php echo __('Search Input', 'blocksy') ?>" />
<button class="search-submit" aria-label="<?php echo __('Search button', 'blocksy')?>">
<svg class="ct-icon" width="15" height="15" viewBox="0 0 15 15" aria-label="<?php echo __('Search icon', 'blocksy') ?>">
<path d="M14.8,13.7L12,11c0.9-1.2,1.5-2.6,1.5-4.2c0-3.7-3-6.8-6.8-6.8S0,3,0,6.8s3,6.8,6.8,6.8c1.6,0,3.1-0.6,4.2-1.5l2.8,2.8c0.1,0.1,0.3,0.2,0.5,0.2s0.4-0.1,0.5-0.2C15.1,14.5,15.1,14,14.8,13.7z M1.5,6.8c0-2.9,2.4-5.2,5.2-5.2S12,3.9,12,6.8S9.6,12,6.8,12S1.5,9.6,1.5,6.8z"/>
</svg>
<span data-loader="circles"><span></span><span></span><span></span></span>
</button>
<?php if (count($any) === 1) { ?>
<input type="hidden" name="post_type" value="<?php echo $any[0] ?>">
<?php } ?>
<?php if (count($any) > 1) { ?>
<input type="hidden" name="ct_post_type" value="<?php echo implode(':', $any) ?>">
<?php } ?>
</form>