-
Notifications
You must be signed in to change notification settings - Fork 0
/
filter-form.php
53 lines (46 loc) · 2.14 KB
/
filter-form.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
<?php
$tags = SleekPontyJob::getAllTags();
$locations = SleekPontyJob::getAllLocations();
$tags = apply_filters('sleek_ponty_tags', $tags);
?>
<form method="get" action="" id="ponty-filter-form" data-submit-onchange>
<p class="input--search">
<input type="text" name="ponty_search" placeholder="<?php _e('Search job', 'sleek') ?>" value="<?php echo $_GET['ponty_search'] ?? '' ?>">
</p>
<?php if ($locations) : ?>
<p class="select locations">
<select name="ponty_location[]">
<option value=""><?php _ex('LOCATION', 'ponty-tag', 'sleek') ?></option>
<?php foreach ($locations as $location) : ?>
<option value="<?php echo $location ?>" <?php echo (isset($_GET['ponty_location']) and in_array($location, $_GET['ponty_location'])) ? 'selected' : '' ?>>
<?php echo $location ?>
</option>
<?php endforeach ?>
</select>
</p>
<?php endif ?>
<?php foreach ($tags as $tag => $terms) : if (count($terms) > 3) : ?>
<p class="select <?php echo sanitize_title($tag) ?>">
<select name="ponty_tag_<?php echo strtolower($tag) ?>[]">
<option value=""><?php _ex($tag, 'ponty-tag', 'sleek') ?></option>
<?php foreach ($terms as $term) : ?>
<option value="<?php echo $term->term_id ?>" <?php echo (isset($_GET['ponty_tag_' . strtolower($tag)]) and in_array($term->term_id, $_GET['ponty_tag_' . strtolower($tag)])) ? 'selected' : '' ?>>
<?php echo $term->name ?>
</option>
<?php endforeach ?>
</select>
</p>
<?php endif; endforeach ?>
<?php foreach ($tags as $tag => $terms) : if (count($terms) < 4) : ?>
<p class="checkbox <?php echo sanitize_title($tag) ?>">
<strong><?php _ex($tag, 'ponty-tag', 'sleek') ?></strong>
<?php foreach ($terms as $term) : ?>
<label>
<input type="checkbox" name="ponty_tag_<?php echo strtolower($tag) ?>[]" value="<?php echo $term->term_id ?>" <?php echo (isset($_GET['ponty_tag_' . strtolower($tag)]) and in_array($term->term_id, $_GET['ponty_tag_' . strtolower($tag)])) ? 'checked' : '' ?>>
<?php echo $term->name ?>
</label>
<?php endforeach ?>
</p>
<?php endif; endforeach ?>
<p class="submit"><button><?php _e('Search', 'sleek') ?></button></p>
</form>