-
Notifications
You must be signed in to change notification settings - Fork 1
/
archive-event.php
71 lines (61 loc) · 1.69 KB
/
archive-event.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
<?php
get_header();
?>
<main>
<div class="event--archive__top">
<h1 class="event--archive__title"><span><?= post_type_archive_title(); ?></span></h1>
</div>
<div class="events">
<?php
$current_date = new DateTime();
$current_date->setTimezone( new DateTimeZone('Europe/Amsterdam') );
$first_past = true;
$post_no = 0;
?>
<?php if(have_posts()){?>
<div class="section">
<?php while(have_posts()) : the_post(); ?>
<?php
$start = new DateTime(get_field('start_datetime'));
$start->setTimezone( new DateTimeZone('Europe/Amsterdam') );
if ($start >= $current_date && $first_past && $post_no === 0):
?>
<div class="section__title__wrapper">
<h2 class="section__title"><span>Upcoming Events</span></h2>
<a href="https://eventix.shop/uaq89ewa" target="_blank">Sign up here!</a>
</div>
<div class="section__wrapper">
<?php
endif;
if ($start < $current_date && $first_past):
$first_past = false;
?>
</div>
<div class="section__title__wrapper">
<h2 class="section__title"><span>Past Events</span></h2>
</div>
<div class="section__wrapper">
<?php endif; ?>
<?php
// Add an order to upcoming events to sort them reverse from how we got them
if ($start > $current_date) {
$order_override = "style='order: -$post_no'";
$post_no++;
} else {
$order_override = '';
}
?>
<?php include( 'inc/event-small.php' ); ?>
<?php endwhile; ?>
</div>
<?php }; ?>
</div>
</main>
<div class="section">
<div class="section__wrapper">
<?php include 'inc/pagination.php'; ?>
</div>
</div>
<?php
get_footer();
?>