-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
320 lines (302 loc) · 10.2 KB
/
index.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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
<?php
get_header();
?>
<main id="maincontent" class="container">
<div class="row">
<?php
// START Banner Query
if ( get_theme_mod('show_banner', false) ):
switch ( get_theme_mod('banner_posts', 'latest' ) ) :
case 'featured' : // Build the query if using the "featured" tag
$args = [
'order' => 'rand',
'post_type' => 'post',
'posts_per_page' => -1,
'tag' => 'featured'
];
break;
case 'latest' : // Build the query if using the latest posts
$args = [
'orderby' => 'date',
'post_type' => 'post',
'posts_per_page' => get_theme_mod('banner_posts_latest_count', 5),
];
break;
case 'cpt' :
$args = [
'post_type' => 'banner',
'posts_per_page' => -1
];
break;
endswitch;
$qrybanner = new WP_Query( $args );
if ( $qrybanner->have_posts() ) :
$carousel = $qrybanner->post_count > 1;
?>
<section id="carouselwrap" <?php echo ( $carousel ? 'class="row swiper-container"' : '' ); ?>>
<div id="carousel" <?php echo ( $carousel ? 'class="swiper-wrapper"' : '' ); ?>>
<?php
while ( $qrybanner->have_posts() ) :
$qrybanner->the_post();
$bgimageposition = get_post_meta($post->ID, '_banner_bgimage_position', true);
$overlayposition = get_post_meta($post->ID, '_banner_overlay_position', true);
?>
<div class="fpbanner<?php echo ( $carousel ? ' swiper-slide' : '' );?><?php echo ( has_post_thumbnail() ? ' fpbannerbg' : '');?>" style="background-color:<?php echo get_post_meta($post->ID, '_banner_bgcolor', true); ?>;<?php echo ( has_post_thumbnail() ? 'background-image:url(' . get_the_post_thumbnail_url($post->ID, 'full') . ');background-size:' . $bgimageposition . ';' : '');?>">
<?php
if ( get_post_meta($post->ID, '_banner_linkurl', true) ) :
?>
<a href="<?php echo esc_url( get_post_meta($post->ID, '_banner_linkurl', true) ); ?>" class="bannerfulllink"></a>
<?php
else :
?>
<div class="<?php echo (has_post_format('video') ? 'bannervideo' : 'bannercontent ' . $overlayposition);?>">
<?php
if ( has_post_format('video') ) :
echo strip_tags(get_the_content(), '<iframe>');
else :
the_content();
endif;
?>
</div>
<?php
endif;
?>
</div><!-- .fpbanner -->
<?php
endwhile;
?>
</div><!-- #carousel -->
<?php if ( $carousel ): ?>
<div class="swiper-pagination"></div>
<script type="text/javascript">
$(document).ready( function() {
var swiperCarousel = new Swiper ('.swiper-container', {
speed: 500,
loop: true,
slidesPerView: 1,
pagination: {
el: '.swiper-pagination',
clickable: true,
},
autoplay: {
delay: 5000,
disableOnInteraction: true,
},
}
);
$('#carouselwrap').hover(
function() {
swiperCarousel.autoplay.stop();
},
function() {
swiperCarousel.autoplay.start();
}
);
$('#carouselwrap').click(
function() {
swiperCarousel.autoplay.stop();
$(this).unbind('hover');
}
);
});
</script>
<?php endif; ?>
</section><!-- #carouselwrap -->
</div>
<?php
endif;
endif; // END BANNER QUERY
// Sub-Banner Widget Area
if ( is_active_sidebar( 'frontpage_subbanner' ) ) :
dynamic_sidebar( 'frontpage_subbanner' );
endif;
// END Sub-Banner Widget Area
?>
<?php
$date = new DateTime(); // Used across queries in this section
// START Announcements Query
$args = array(
'post_type' => 'news', // Pull posts of type "announcement"
'posts_per_page' => 3, // Only the 3 closest to expiration will be listed
'orderby' => 'date', // We want to organize the announcements by date
'meta_key' => '_news_ann_expiration', // Grab the announcements' expiration date
'order' => 'DESC',
'meta_query' => array(
array(
'key' => '_news_posttype',
'value' => 'announcement',
'compare' => '='
),
array(
'key' => '_news_ann_expiration', // Check the expiration date field
'value' => $date->getTimestamp(),
'compare' => '>=', // Return the ones after today's date
)
)
);
$qryannouncements = new WP_Query( $args );
if ( $qryannouncements->have_posts() ) :
?>
<div id="announcements">
<h1>Announcements</h1>
<?php
// START Announcements Loop
while ( $qryannouncements->have_posts() ):
$qryannouncements->the_post();
$urgent = ( get_post_meta( $post->ID, '_news_ann_urgent', true) ? true : false );
?>
<article class="announcement<?= $urgent ? ' urgent' : null; ?>">
<?php if ( $urgent ) : ?>
<div class="urgenticon">
<i class="far fa-exclamation-circle"></i>
</div>
<?php endif; ?>
<div class="announcementcontent">
<a href="<?php the_permalink(); ?>"></a>
<h2><?php the_title(); ?></h2>
<div class="text-em"><?php the_date(); ?></div>
<div><?php
if ( get_post_meta( $post->ID, '_news_ann_showfullonfp', true ) ) :
the_content();
else :
the_excerpt();
endif; ?>
</div>
</div><!-- .announcementcontent -->
</article><!-- .announcement -->
<?php
endwhile; // END Announcements Loop
?>
</div><!-- #announcements -->
<?php
endif; // END Announcements Query
// START Front Page Content Query
$args = array(
'post_type' => 'frontpage', // Pull posts of type "frontpage"
'posts_per_page' => -1, // All posts will be returned
'orderby' => 'meta_value_num', // We want to organize the content by its title (posts should be titled "1 - Actual Title" to signify the order in which to display on the home page)
'meta_key' => "_fp_order",
'order' => 'ASC',
);
$qryfpcontent = new WP_Query( $args );
if ( $qryfpcontent->have_posts() ) :
while ( $qryfpcontent->have_posts() ) : // START Front Page Content Loop
$qryfpcontent->the_post();
?>
<article class="fppost">
<?php if (! get_post_meta( $post->ID, '_fp_hidetitle', true ) ) : ?>
<h1><?php the_title(); ?></h1>
<?php endif; ?>
<?php the_content(); ?>
<div class="clearfix"></div> <!-- stupid fix for floated images that exceed the length of the text -->
</article><!-- .fpppost -->
<hr class="space-vert-3x" />
<?php
endwhile; // END Front Page Content Loop
endif; // END Front Page Content Query
// START Statements Query
if ( get_theme_mod('show_statements', false) ) :
// Get theme settings to see if we show statements and news or just statements
get_theme_mod('statements_also_show_news') ? $statements_posttypes = array( 'statement', 'news' ) : $statements_posttypes = array( 'statement' );
$args = array(
'post_type' => $statements_posttypes, // Pull post type
'posts_per_page' => 3, // Only the 8 closest to expiration will be listed
'orderby' => 'date', // We want to organize the posts by date
'order' => 'DESC'
);
$qrystatements = new WP_Query( $args );
if ( $qrystatements->have_posts() ) :
?>
<section id="statements">
<?php if (get_theme_mod('statements_name', false)) : ?>
<h1 class="blogtitle"><?php echo get_theme_mod('statements_name'); ?></h1>
<?php if (get_theme_mod('statements_subtitle', false)) : ?>
<p class="blogsubtitle"><?php echo get_theme_mod('statements_subtitle'); ?></p>
<?php endif; ?>
<?php endif; ?>
<?php
// START Statements Loop
while ( $qrystatements->have_posts() ):
$qrystatements->the_post();
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?> style="margin-bottom:2em;">
<div style="line-height: 16px;font-size: 12px;color: #241F20;"><?php the_time('F j, Y'); ?></div>
<h2 style="margin-top:.25em;">
<a style="line-height: 28px;font-size: 20px;text-decoration-line: underline;color: #241F20;" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a>
</h2>
<div class="row">
<div class="content col" style="line-height: 22px;font-size: 16px;">
<?php the_excerpt() ?>
</div>
</div>
<br>
<hr class="fullwidth"/>
</article>
<?php
endwhile; // END Statements Loop
if ( $qrystatements->found_posts > 3 ) :
?>
<div class="text-2xl text-center space-top-1x uppercase mb-4">
<a href="<?php echo get_post_type_archive_link('statement'); ?>">More <?php echo get_theme_mod('statements_name', 'statements'); ?> <i class="far fa-arrow-circle-right"></i></a>
</div>
<?php
endif;
?>
</section><!-- #blog -->
<?php
endif;
endif; // END Statements Query
// START Blog Query
if ( get_theme_mod('show_blog', false) ) :
$args = array(
'post_type' => array('blog'), // Pull post type
'posts_per_page' => 3, // Only the 8 closest to expiration will be listed
'orderby' => 'date', // We want to organize the posts by date
'order' => 'DESC'
);
$qryblog = new WP_Query( $args );
if ( $qryblog->have_posts() ) :
?>
<section id="blog">
<?php if (get_theme_mod('blog_name', false)) : ?>
<h1 class="blogtitle"><?php echo get_theme_mod('blog_name'); ?></h1>
<?php if (get_theme_mod('blog_subtitle', false)) : ?>
<p class="blogsubtitle"><?php echo get_theme_mod('blog_subtitle'); ?></p>
<?php endif; ?>
<?php endif; ?>
<?php
// START Blog Loop
while ( $qryblog->have_posts() ):
$qryblog->the_post();
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?> style="margin-bottom:2em;">
<div style="line-height: 16px;font-size: 12px;color: #241F20;"><?php the_time('F j, Y'); ?></div>
<h2 style="margin-top:.25em;">
<a style="line-height: 28px;font-size: 20px;text-decoration-line: underline;color: #241F20;" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a>
</h2>
<div class="row">
<div class="content col" style="line-height: 22px;font-size: 16px;">
<?php the_excerpt() ?>
</div>
</div>
<br>
<hr class="fullwidth"/>
</article>
<?php
endwhile; // END Blog Loop
if ( $qryblog->found_posts > 3 ) :
?>
<div class="text-2xl text-center space-top-1x uppercase mb-4">
<a href="<?php echo get_post_type_archive_link('blog'); ?>">More <?php echo get_theme_mod('blog_name', 'blog entries'); ?> <i class="far fa-arrow-circle-right"></i></a>
</div>
<?php
endif;
?>
</section><!-- #blog -->
<?php
endif;
endif; // END Blog Query
?>
<!-- <?php //get_sidebar(); ?> -->
</main>
<?php get_footer(); ?>