forked from interglobalvision/pindropstudio-com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpage-live.php
executable file
·148 lines (118 loc) · 3.84 KB
/
page-live.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
<?php
get_header();
?>
<main id="main-content">
<div id="page-live" class="container">
<?php
$now = new \Moment\Moment('now', 'Europe/London');
$midnight = $now->startOf('day');
$midnight_timestamp = strtotime($midnight->format());
$forthcoming_events = new WP_Query(array(
'post_type' => 'event',
'posts_per_page' => -1,
'orderby' => 'meta_value',
'order' => 'ASC',
'meta_key' => '_igv_event_datetime',
'meta_query' => array(
array(
'key' => '_igv_event_datetime',
'value' => $midnight_timestamp,
'type' => 'numeric',
'compare' => '>',
),
),
));
if ($forthcoming_events->have_posts()) {
$post_count = $forthcoming_events->post_count;
?>
<div class="grid-row margin-bottom-small">
<?php render_divider('Forthcoming Live Events'); ?>
</div>
<div class="grid-row justify-center js-match-height-group" data-match-height-targets='["event-forthcoming-title", "event-forthcoming-datetime", "event-forthcoming-buttons"]'>
<?php
while ($forthcoming_events->have_posts()) {
$forthcoming_events->the_post();
get_template_part('partials/custom-pages/event-forthcoming');
}
?>
</div>
<?php
}
?>
<div class="grid-row margin-top-large margin-bottom-basic">
<?php render_divider('<a href="' . home_url('event') . '">Past Events +</a>'); ?>
</div>
<div class="shuffle-section media-items margin-top-basic margin-bottom-large">
<div class="shuffle-preloader"></div>
<div class="shuffle-container grid-row hidden">
<?php
$overrides = IGV_get_option('_igv_live_options', '_igv_override_events');
$total_posts = 15;
$posts_needed = $total_posts;
$not_in = array();
if ($overrides) {
$overrides = explode(', ', $overrides);
$posts_needed = $posts_needed - count($overrides);
$not_in = $overrides;
}
if ($posts_needed > 0) {
$past_args = array(
'post_type' => 'event',
'posts_per_page' => $posts_needed,
'post__not_in' => $not_in,
'meta_query' => array(
array(
'key' => '_igv_event_datetime',
'value' => $midnight_timestamp,
'type' => 'numeric',
'compare' => '<',
),
),
);
$past_events = get_posts($past_args);
$past_event_ids = array_map('array_map_filter_ids', $past_events);
if ($overrides) {
$past_event_ids = array_merge($overrides, $past_event_ids);
}
} else {
$past_event_ids = $overrides;
}
$past_events = new WP_Query(array(
'post_type' => 'event',
'posts_per_page' => $total_posts,
'post__in' => $past_event_ids,
'meta_query' => array(
array(
'key' => '_igv_event_datetime',
'value' => $midnight_timestamp,
'type' => 'numeric',
'compare' => '<',
),
),
));
if ($past_events->have_posts()) {
while ($past_events->have_posts()) {
$past_events->the_post();
get_template_part('partials/custom-pages/event-archive');
}
}
?>
</div>
</div>
<?php
$quote_text = IGV_get_option('_igv_quote_options', '_igv_live_quote_text');
$quote_person = IGV_get_option('_igv_quote_options', '_igv_live_quote_person');
$quote_luminary = IGV_get_option('_igv_quote_options', '_igv_live_quote_luminary');
if ($quote_text && $quote_person) {
?>
<div class="grid-row margin-top-large">
<?php render_quote($quote_text, $quote_person, $quote_luminary); ?>
</div>
<?php
}
?>
</div>
</main>
<?php
get_footer();
?>