-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharchive-exhibition.php
178 lines (108 loc) · 5.66 KB
/
archive-exhibition.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
173
174
175
176
177
178
<?php
/**
* The template for displaying beauty archive pages
*
* @link https://codex.wordpress.org/Template_Hierarchy
*
* @package WordPress
* @subpackage Twenty_Seventeen
* @since 1.0
* @version 1.0
*/
get_header(); ?>
<div class="wrap">
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php
$queried = get_queried_object();
$current = "";
if( is_post_type_archive( 'exhibition' ) ){
$current = "post_type";
}elseif ( is_tax( 'exhibition_city_state' ) ){
$current = $queried->term_id;
$is_current_top = ( $queried->parent == 0 ) ? "yes" : "no";
}
$args = array(
'taxonomy' => 'exhibition_city_state',
'hide_empty' => false,
//'hierarchical' => true,
'parent' => 0
);
$terms = get_terms( $args );
if ( !empty( $terms ) ){
?>
<div class="filter-wrapper row exhibition-filter-wrapper">
<div class="col-sm-3">
<select name="exhibition_state" class="exhibition-select-state exhibition-filter">
<option <?php if( !$current || $current =="post_type" ) echo 'selected="selected"';?> value="<?php echo esc_url( get_post_type_archive_link('exhibition') );?>"> <?php echo __("All States" , "bishel");?> </option>
<?php
foreach( $terms AS $term ){
$term_link = get_term_link( $term );
$selected = ( $current == $term->term_id ) || ( $current && $current != "post_type" && $is_current_top == "no" && $queried->parent == $term->term_id ) ;
?>
<option <?php if( $selected ) echo 'selected="selected"';?> value="<?php echo esc_url( $term_link );?>"><?php echo $term->name;?></option>
<?php
}
?>
</select>
</div>
<div class="col-sm-3">
<select name="exhibition_city" class="exhibition-select-city exhibition-filter">
<?php
if( $current && $current != "post_type" && $is_current_top == "no" ) {
$term_link = get_term_link( get_term( $queried->parent ) );
}else{
$term_link = "";
}
?>
<option value="<?php echo esc_url( $term_link );?>"> <?php echo __("All Cities" , "bishel");?> </option>
<?php
$args = array(
'taxonomy' => 'exhibition_city_state',
'hide_empty' => false,
//'hierarchical' => true,
);
if( $current && $current != "post_type" ){
if( $is_current_top == "yes" ) {
$args['parent'] = $current;
}else{
$args['parent'] = $queried->parent;
}
}
$terms = get_terms( $args );
foreach( $terms AS $term ){
$term_link = get_term_link( $term );
?>
<option <?php if( $current == $term->term_id ) echo 'selected="selected"';?> class="<?php if( $term->parent == 0 ) echo "top"; ?>" value="<?php echo esc_url( $term_link );?>"><?php echo $term->name;?></option>
<?php
}
?>
</select>
</div>
<div class="col-sm-6"> </div>
</div>
<?php
}
if ( have_posts() ) : ?>
<div class="exhibition-posts-wrapper row">
<?php
/* Start the Loop */
while ( have_posts() ) : the_post();
get_template_part( 'template-parts/custom-post-type/content-exhibition' );
endwhile;
?>
</div>
<?php
the_posts_pagination( array(
'prev_text' => twentyseventeen_get_svg( array( 'icon' => 'arrow-left' ) ) . '<span class="screen-reader-text">' . __( 'Previous page', 'twentyseventeen' ) . '</span>',
'next_text' => '<span class="screen-reader-text">' . __( 'Next page', 'twentyseventeen' ) . '</span>' . twentyseventeen_get_svg( array( 'icon' => 'arrow-right' ) ),
'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'twentyseventeen' ) . ' </span>',
) );
else :
get_template_part( 'template-parts/post/content', 'none' );
endif; ?>
</main><!-- #main -->
</div><!-- #primary -->
<?php get_sidebar(); ?>
</div><!-- .wrap -->
<?php get_footer();