-
Notifications
You must be signed in to change notification settings - Fork 217
/
page-search.php
160 lines (153 loc) · 8.6 KB
/
page-search.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<?php
/**
* Page template search.
*
* @package Aquila
*/
get_header();
$filters_data = get_filters_data();
?>
<div id="primary">
<main id="main" class="site-main mt-5" role="main">
<aquila-search class="aquila-search row px-4">
<aquila-filters class="col-lg-3 col-md-3 col-sm-12 pb-4">
<aquila-clear-all-filters class="clear-all-filters"><button class="btn btn-secondary">Clear All filters</button></aquila-clear-all-filters>
<?php foreach ( $filters_data as $filter_data ) : ?>
<aquila-checkbox-accordion
class="checkbox-accordion"
key="<?php echo esc_attr( $filter_data['slug'] ?? '' ); ?>"
label="<?php echo esc_attr( $filter_data['label'] ?? '' ); ?>"
>
<?php if ( ! empty( $filter_data['label'] ) ) : ?>
<div class="checkbox-accordion__handle" role="button">
<div class="checkbox-accordion__handle-text"><?php echo esc_html( $filter_data['label'] ); ?></div>
<span class="checkbox-accordion__handle-icon"></span>
</div>
<?php endif; ?>
<aquila-checkbox-accordion-content class="checkbox-accordion__content">
<?php foreach ( $filter_data['children'] as $item ) : ?>
<?php
$has_children = ! empty( $item['children'] ) && is_array( $item['children'] );
$has_content_class = ! empty( $has_children ) ? 'checkbox-accordion__child--has-content' : '';
?>
<!--Level One - Children-->
<?php if ( ! empty( $item['label'] ) ) : ?>
<aquila-checkbox-accordion-child class="checkbox-accordion__child <?php echo esc_attr( $has_content_class ); ?>">
<div class="checkbox-accordion__child-handle form-field">
<label data-text="<?php echo esc_attr( $item['label'] ); ?>" class="checkbox">
<input
data-text="<?php echo esc_attr( $item['label'] ); ?>"
type="checkbox"
data-key="<?php echo esc_attr( $filter_data['slug'] ?? '' ); ?>"
value="<?php echo esc_attr( $item['value'] ); ?>"
<?php if ( ! empty( $has_children ) ) : ?>
data-has-children="true"
<?php endif; ?>
>
<span data-text="<?php echo esc_attr( $item['label'] ); ?>" class="checkbox-text"><?php echo wp_kses_post( $item['label'] ); ?></span>
</label>
<?php if ( ! empty( $has_children ) ) : ?>
<span data-text="<?php echo esc_attr( $item['label'] ); ?>" class="checkbox-accordion__lvl-one-icon checkbox-accordion__child-handle-icon"></span>
<?php endif; ?>
</div>
<!--Level Two - Grand Children-->
<?php if ( $has_children ) : ?>
<div class="checkbox-accordion__child-content">
<?php foreach ( $item['children'] as $child ) : ?>
<?php
$has_grand_children = ! empty( $child['children'] ) && is_array( $child['children'] );
?>
<?php if ( ! empty( $child['label'] ) && ! empty( $child['value'] ) ) : ?>
<aquila-checkbox-accordion-child class="checkbox-accordion__child">
<div class="checkbox-accordion__child-handle form-field">
<label data-text="<?php echo esc_attr( $child['label'] ); ?>" class="checkbox">
<input
data-key="<?php echo esc_attr( $filter_data['slug'] ?? '' ); ?>"
data-text="<?php echo esc_attr( $child['label'] ); ?>"
data-parents="<?php echo esc_attr( $item['value'] ); ?>"
<?php if ( ! empty( $has_grand_children ) ) : ?>
data-has-children="true"
<?php endif; ?>
type="checkbox"
value="<?php echo esc_attr( $child['value'] ); ?>"
>
<span data-text="<?php echo esc_attr( $child['label'] ); ?>" class="checkbox-text"><?php echo wp_kses_post( $child['label'] ); ?></span>
</label>
<?php if ( ! empty( $has_grand_children ) ) : ?>
<span data-text="<?php echo esc_attr( $child['label'] ); ?>" class="checkbox-accordion__child-handle-icon"></span>
<?php endif; ?>
</div>
<!--Level Three Great Grand Children-->
<?php if ( ! empty( $has_grand_children ) ) : ?>
<div class="checkbox-accordion__child-content">
<?php foreach ( $child['children'] as $grand_children ) : ?>
<?php
$has_great_grand_children = ! empty( $grand_children['children'] ) && is_array( $grand_children['children'] );
$has_content_class = ! empty( $has_great_grand_children ) ? 'checkbox-accordion__child--has-content' : '';
?>
<?php if ( ! empty( $grand_children['label'] ) && ! empty( $grand_children['value'] ) ) : ?>
<aquila-checkbox-accordion-child class="checkbox-accordion__child <?php echo esc_attr( $has_content_class ); ?>">
<div class="checkbox-accordion__child-handle form-field">
<label data-text="<?php echo esc_attr( $grand_children['label'] ); ?>" class="checkbox">
<input
data-key="<?php echo esc_attr( $filter_data['slug'] ?? '' ); ?>"
data-text="<?php echo esc_attr( $grand_children['label'] ); ?>"
<?php if ( ! empty( $has_great_grand_children ) ) : ?>
data-has-children="true"
<?php endif; ?>
data-parents="<?php echo esc_attr( sprintf( '%1s,%2s', $item['value'], $child['value'] ) ); ?>"
type="checkbox"
value="<?php echo esc_attr( $grand_children['value'] ); ?>"
>
<span data-text="<?php echo esc_attr( $grand_children['label'] ); ?>" class="checkbox-text"><?php echo wp_kses_post( $grand_children['label'] ); ?></span>
</label>
<?php if ( ! empty( $has_great_grand_children ) ) : ?>
<span data-text="<?php echo esc_attr( $grand_children['label'] ); ?>" class="checkbox-accordion__child-handle-icon"></span>
<?php endif; ?>
</div>
<?php if ( ! empty( $has_great_grand_children ) ) : ?>
<div class="checkbox-accordion__child-content">
<?php foreach ( $grand_children['children'] as $great_grand_children ) : ?>
<?php if ( ! empty( $great_grand_children['label'] ) && ! empty( $great_grand_children['value'] ) ) : ?>
<div class="checkbox-accordion__child-handle checkbox-accordion__child-handle--lvl-four form-field">
<label data-text="<?php echo esc_attr( $great_grand_children['label'] ); ?>" class="checkbox">
<input
data-key="<?php echo esc_attr( $filter_data['slug'] ?? '' ); ?>"
data-text="<?php echo esc_attr( $great_grand_children['label'] ); ?>"
data-parents="<?php echo esc_attr( sprintf( '%1s,%2s,%3s', $item['value'], $child['value'], $grand_children['value'] ) ); ?>"
type="checkbox"
value="<?php echo esc_attr( $great_grand_children['value'] ); ?>"
>
<span data-text="<?php echo esc_attr( $great_grand_children['label'] ); ?>" class="checkbox-text"><?php echo wp_kses_post( $great_grand_children['label'] ); ?></span>
</label>
</div>
<?php endif; ?>
<?php endforeach; ?>
</div>
<?php endif; ?>
</aquila-checkbox-accordion-child>
<?php endif; ?>
<?php endforeach; ?>
</div>
<?php endif; ?>
</aquila-checkbox-accordion-child>
<?php endif; ?>
<?php endforeach; ?>
</div>
<?php endif; ?>
</aquila-checkbox-accordion-child>
<?php endif; ?>
<?php endforeach; ?>
</aquila-checkbox-accordion-content>
</aquila-checkbox-accordion>
<?php endforeach; ?>
</aquila-filters>
<div class="col-lg-9 col-md-9 col-sm-12 pb-4">
<aquila-results-count class="aquila-results-count"></aquila-results-count>
<aquila-results class="row"></aquila-results>
<aquila-loading-more class="aquila-loading-more"></aquila-loading-more>
</div>
</aquila-search>
</main>
</div>
<?php get_footer(); ?>