-
Notifications
You must be signed in to change notification settings - Fork 1
/
category-maihaugen-gallery.php
165 lines (113 loc) · 4.42 KB
/
category-maihaugen-gallery.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
<?php
/**
* The template for displaying Category pages for Maihaugen Gallery on Exhibits site.
*
* @package MIT_Libraries_Child
* @since 2.0.0
*/
get_header();
?>
<?php get_template_part( 'inc/breadcrumbs', 'category' ); ?>
<div id="stage" class="inner" role="main">
<?php get_template_part( 'inc/postHead' ); ?>
<div id="content" class="content has-sidebar">
<div class="main-content">
<?php
$current_query = new WP_Query(
array(
'posts_per_page' => -1,
'ignore_sticky_posts' => false,
'category_name' => 'maihaugen-gallery',
'meta_key' => 'start_date', // Load up the event_date meta.
'orderby' => 'start_date',
'order' => 'DESC', // Descending, so later events first.
'meta_query' => array(
array(
'key' => 'start_date', // Which meta to query.
'value' => date( 'Y-m-d' ), // Value for comparison.
'compare' => '<=', // Method of comparison.
'type' => 'DATE',
),
array(
'key' => 'end_date', // Which meta to query.
'value' => date( 'Y-m-d' ), // Value for comparison.
'compare' => '>=', // Method of comparison.
'type' => 'DATE',
), // The meta_query is an array of query items.
), // End meta_query array.
) // End array.
); // Close WP_Query constructor call.
?>
<div class="exhibits-feed-section">
<h3 class="title-sub">Current Exhibits</h3>
<?php if ( $current_query->have_posts() ) :
while ( $current_query->have_posts() ) : $current_query->the_post(); // Loop for current exhibits.
get_template_part( 'inc/exhibits-current' );
endwhile;
wp_reset_postdata();
else : ?>
<p><?php esc_html_e( 'There are no current exhibit announcements at this time. New exhibits are added throughout the year, so please check back.' ); ?></p>
<?php endif; ?>
</div>
<!-- END OF CURRENT EXHIBITS LOOP -->
<?php
$future_query = new WP_Query(
array(
'category_name' => 'maihaugen-gallery',
'meta_key' => 'start_date', // Load up the event_date meta.
'orderby' => 'start_date',
'order' => 'ASC', // Descending, so later events first.
'meta_query' => array(
array(
'key' => 'start_date', // Which meta to query.
'value' => date( 'Y-m-d' ), // Value for comparison.
'compare' => '>', // Method of comparison.
'type' => 'DATE',
), // The meta_query is an array of query items.
), // End meta_query array.
) // End array.
); // Close WP_Query constructor call.
?>
<div class="exhibits-feed-section">
<h3 class="title-sub">Upcoming Exhibits</h3>
<?php if ( $future_query->have_posts() ) :
while ( $future_query->have_posts() ) : $future_query->the_post(); // Loop for future exhibits.
get_template_part( 'inc/exhibits-upcoming' );
endwhile;
wp_reset_postdata();
else : ?>
<p><?php esc_html_e( 'There are no upcoming exhibit announcements at this time. New exhibits are added throughout the year, so please check back.' ); ?></p>
<?php endif; ?>
</div>
<!-- END OF UPCOMING EXHIBITS LOOP -->
<?php
$past_query = new WP_Query(
array(
'category_name' => 'maihaugen-gallery',
'meta_key' => 'end_date', // Load up the event_date meta.
'orderby' => 'end_date',
'order' => 'DESC', // Descending, so later events first.
'meta_query' => array(
array(
'key' => 'end_date', // Which meta to query.
'value' => date( 'Y-m-d' ), // Value for comparison.
'compare' => '<', // Method of comparison.
'type' => 'DATE',
), // The meta_query is an array of query items.
), // End meta_query array.
) // End array.
); // Close WP_Query constructor call.
?>
<div class="exhibits-feed-section">
<h3 class="title-sub">Past Exhibits</h3>
<?php while ( $past_query->have_posts() ) : $past_query->the_post(); // Loop for events.
get_template_part( 'inc/exhibits-past' );
wp_reset_postdata(); // Restore global post data stomped by the_post().
endwhile; // End of the loop. ?>
</div>
<!-- END OF UPCOMING EXHIBITS LOOP -->
</div><!-- main-content -->
<?php get_sidebar(); ?>
</div><!-- content -->
</div><!-- stage -->
<?php get_footer(); ?>