-
Notifications
You must be signed in to change notification settings - Fork 0
/
page-our-work-search.php
172 lines (122 loc) · 5.86 KB
/
page-our-work-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
161
162
163
164
165
166
167
168
169
170
171
172
<?php
/* Template Name: Our Work + Search */
get_header();
?>
<main class="wrapper">
<?php get_template_part( 'template-parts/page/page', 'tabs' ); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<section class="content subpage">
<div class="wrap">
<header>
<h1><?php the_title(); ?></h1>
<?php the_post_thumbnail('full', array('class' => 'icon')); ?>
</header>
<?php endwhile; endif; wp_reset_postdata(); ?>
<?php if ( is_page('INECC Events') ) : ?>
<section class="events posts" id="eventsContainer">
<?php get_template_part( 'template-parts/list', 'events' ); ?>
</section>
<?php endif; ?>
<?php if ( is_page('INECC Press') ) : ?>
<section class="press posts">
<?php get_template_part( 'template-parts/list', 'press' ); ?>
</section>
<?php endif; ?>
<?php if ( is_page('INECC Publications') ) : ?>
<section class="publications posts">
<?php get_template_part( 'template-parts/list', 'publications' ); ?>
</section>
<?php endif; ?>
</div>
<aside class="search-filter" id="searchOrFilter">
<div class="tabs" id="searchOrFilterTabs">
<div class="btn-container"><a class="button search" >Search</a></div>
<div class="btn-container"><a class="button filter" >Filter</a></div>
</div>
<button class="button close" id="closeSearchOrFilter"></button>
<section class="search" id="searchBlock">
<h2>Search</h2>
<form class="form-search" action="<?php esc_url(get_permalink()); ?>" method="GET">
<input type="text" placeholder="What are you looking for?" required name="search" />
<div class="btn-container submit">
<button class="button has-white-color" type="submit">Search</button>
</div>
</form>
</section>
<section class="filter" id="filterBlock">
<h2>Filter</h2>
<form class="form-filter" action="<?php esc_url(get_permalink()); ?>" method="GET">
<fieldset class="filter-by-areas-of-work">
<legend>
By: Key area of work
<em>Select one option</em>
</legend>
<?php
$page_name = end( explode( '-', $post->post_name ) );
$category = get_term_by('slug', $page_name, 'category');
$category_id = $category->term_id;
$taxonomies = array(
'category'
);
$args = array(
// 'parent' => $category_id,
'child_of' => $category_id,
'orderby' => 'name',
'hide_empty' => 0
);
$sub_categories = get_terms($taxonomies, $args);
//var_dump( $sub_categories );
foreach ( $sub_categories as $category ) {
$cat_id = $category->term_id;
$cat_name = preg_replace('/[ ,]+/', '', strtolower($category->name));
print '<label for="' . $cat_name . '">';
print '<input type="radio" id="' . $cat_name . '" value="' . $cat_id . '" name="cat">';
print $category->name . '</label>';
}
?>
</fieldset>
<?php if ($page_name == "events"): ?>
<fieldset class="filter-by-location">
<legend>By: Location</legend>
<label for="localities">States</label>
<select name="local" id="localities">
<?php
$localities = get_meta_values( 'event_place', 'post' );
print '<option disabled selected value>All states</option>';
if( !empty( $localities ) ) {
foreach( $localities as $locality ){
//$locality_val = preg_replace('/[ ,]+/', '', strtolower($locality));
print '<option value="'.$locality.'">'.$locality.'</option>';
}
}
?>
</select>
</fieldset>
<?php endif; ?>
<div class="btn-container submit">
<button class="button has-white-color" type="submit" >Apply filter</button>
</div>
</form>
</section>
</aside>
</section>
</main>
<aside class="content parent wrapper">
<?php
//Get parent content
$parent_id = $post -> post_parent;
$args = array(
'page_id' => $parent_id,
'post_type' => array( 'page' ),
'post_status' => array( 'publish' ),
'posts_per_page' => 1
);
$parent_page = new WP_Query( $args );
if ( $parent_page->have_posts() ) : while ( $parent_page->have_posts() ) : $parent_page->the_post(); ?>
<header>
<h3><?php the_title(); ?></h3>
</header>
<?php endwhile; endif; wp_reset_postdata(); ?>
<?php the_content(); ?>
</aside>
<?php get_footer(); ?>