-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsearchform.php
69 lines (69 loc) · 4.5 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
<div itemscope itemtype="https://schema.org/WebSite">
<link itemprop="url" href="https://botwiki.org/"/>
<form class="search-form<?php
if ( is_search() ){
echo ' search-form px-5 pt-3 pb-5 ';
}
?>" itemprop="potentialAction" itemscope itemtype="http://schema.org/SearchAction" class="form mt-5 mt-md-0 mb-5 text-right pr-0 w-100" method="get" action="<?php echo home_url(); ?>" role="search">
<meta itemprop="target" content="https://botwiki.org/?s={s}"/>
<div class="container mt-3 pl-0 pr-0 text-left">
<div class="row w-100 pl-1 pr-1">
<div class="col-sm-12 mt-2 pl-0 pr-0">
<input itemprop="query-input" required pattern="\s*(\S\s*){2,}" title="What would you like to search for?" id="search-input" class="form-control mt-3 mb-3 mr-sm-2" type="search" name="s" placeholder="<?php _e( 'Search...', 'botwiki' ); ?>" aria-label="Search" value="<?php echo get_search_query(); ?>">
</div>
</div>
</div>
<div id="search-filters" class="container mt-1 pl-0 pr-0 text-left<?php if ( !is_search() ) { echo ' slide-up-hidden'; } ?>">
<div class="row w-100 pl-1 pr-1">
<div class="col-sm-12 mt-2 pl-1 pr-1">
<div class="form-check form-check-inline d-xs-block">
<input class="form-check-input" type="radio" id="search-filters-bots" name="search-filters-options[]" value="bots"<?php if ( !empty($_GET['search-filters-options']) && in_array('bots', $_GET['search-filters-options'] ) ){ echo ' checked'; } ?>>
<label class="form-check-label" for="search-filters-bots">Bots</label>
</div>
<div class="form-check form-check-inline d-xs-block">
<input class="form-check-input" type="radio" id="search-filters-tutorials" name="search-filters-options[]" value="tutorials"<?php if ( !empty($_GET['search-filters-options']) && in_array('tutorials', $_GET['search-filters-options'] ) ){ echo ' checked'; } ?>>
<label class="form-check-label" for="search-filters-tutorials">Tutorials</label>
</div>
<div class="form-check form-check-inline d-xs-block">
<input class="form-check-input" type="radio" id="search-filters-resources" name="search-filters-options[]" value="resources"<?php if ( !empty($_GET['search-filters-options']) && in_array('resources', $_GET['search-filters-options'] ) ){ echo ' checked'; } ?>>
<label class="form-check-label" for="search-filters-resources">All resources</label>
</div>
<div class="form-check form-check-inline d-xs-block">
<input class="form-check-input" type="radio" id="search-filters-everything" name="search-filters-options[]" value="everything"<?php if ( ( !empty($_GET['search-filters-options']) && in_array('everything', $_GET['search-filters-options'] ) ) || empty( $_GET['search-filters-options'] ) ){ echo ' checked'; } ?>>
<label class="form-check-label" for="search-filters-everything">Everything</label>
</div>
</div>
<div class="col-sm-12 mt-4 pl-1 pr-1">
<div class="form-row row">
<label for="bot-info-1-network">Network</label>
<select class="form-control js-select2" name="networks" placeholder="Twitter, Tumblr, Slack, …" data-minimum-input-length="0" data-clear="true" data-multiple="true" data-tags="false">
<?php
$networks = get_terms( 'network', array(
'hide_empty' => false,
) );
foreach ($networks as $network) { ?>
<option <?php if ( isset( $_GET['networks'] ) && in_array($network->slug, explode( ',', $_GET['networks'] )) ){
echo 'selected ';
} ?> value="<?php echo $network->slug ?>"><?php echo $network->name ?></option>
<?php }
?>
</select>
</div>
</div>
<div class="col-sm-12 mt-4 pl-1 pr-1">
<div class="form-row row">
<label><input id="search-filter-opensource" name="opensource" type="checkbox" value="true" <?php
if ( isset( $_GET['opensource'] ) ){
checked( $_GET['opensource'], 'true' );
} ?>> Open-source</label>
</div>
</div>
<div class="col-sm-12 mt-4 pl-1 pr-1">
<div class="text-left">
<button class="btn btn-outline-success my-2 my-sm-0 mx-n1" type="submit" role="button">Search</button>
</div>
</div>
</div>
</div>
</form>
</div>