-
Notifications
You must be signed in to change notification settings - Fork 0
/
front-page.php
201 lines (185 loc) · 7.37 KB
/
front-page.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
<?php
get_header();
echo '<article>';
// Get home page blurb
if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<?= component('edit_button') ?>
<section id="fp-blurb" <?php post_class('fp-section fp-section--blurb'); ?>>
<div class="entry"><?php the_content(); ?></div>
<p class="social-link">
<?= component(
'button_link',
array(
'href' => 'https://www.facebook.com/pages/Harvard-Group-for-New-Music/130937206919388',
'html' => get_field('front_page_facebook_link_text', 'option') . component('icon', array('type' => 'facebook'))
)
) ?>
</p>
</section><!-- #post -->
<?php endwhile; ?>
<?php else: ?>
<?php endif;
// Get upcoming concerts
$today = date('Ymd', strtotime('now'));
$concerts = event_query(array(
'maxposts' => 1,
'post_type' => 'concert',
'order' => 'ASC',
'after' => $today,
));
// Get upcoming colloquia
$colloquia = event_query(array(
'maxposts' => 3,
'post_type' => 'colloquium',
'order' => 'ASC',
'after' => $today,
));
// Get upcoming miscellaneous events
$miscevents = event_query(array(
'maxposts' => 1,
'post_type' => 'miscevent',
'order' => 'ASC',
'after' => $today,
));
// Display upcoming events
if ($concerts || $colloquia || $miscevents) : ?>
<section id="events" class="section--events fp-section bg-overlay clearfix">
<h2>Events</h2>
<ul>
<?php if ($concerts) : ?>
<li class="concerts <?php if (!$colloquia) {
echo 'solo';
} ?>">
<h3 class="sans-sc-h3">Next Concert</h3>
<?php foreach ($concerts as $concert) {
echo component('concert_list_item', array(
"id" => $concert->ID,
"el" => "div"
));
} ?>
</li>
<?php endif; ?>
<?php if ($colloquia) : ?>
<li class="colloquia <?php if (!$concerts) {
echo 'solo';
} ?>">
<h3 class="sans-sc-h3">Upcoming Colloquia</h3>
<?= component('colloquium_list', array(
"colloquia" => $colloquia,
"show_map_link" => true
)) ?>
</li>
<?php endif; ?>
<?php if ($miscevents) : ?>
<li class="miscevents">
<h3 class="sans-sc-h3">Other Events</h3>
<ul>
<?php foreach ($miscevents as $miscevent): ?>
<li class="vevent clearfix">
<h4 class="dtstart">
<?php
$dtstart = DateTime::createFromFormat('d/m/Y', get_field('dtstart', $miscevent->ID));
$dtend = DateTime::createFromFormat('d/m/Y', get_field('dtend', $miscevent->ID));
echo '<time class="value-title" datetime="' . $dtstart->format('Y-m-d\TH:i:sO') . '" title="' . $dtstart->format('Y-m-d\TH:i:sO') . '">';
if (get_field('dtend', $miscevent->ID)) :
if ($dtstart->format('n') == $dtend->format('n')) :
echo $dtstart->format('n/j') . '–' . $dtend->format('j');
else :
echo $dtstart->format('n/j') . '–' . $dtend->format('n/j');
endif; ?>
<?php else : ?>
<?php echo $dtstart->format('n/j'); ?>
<?php endif; ?>
</time>
</h4>
<span class="summary"><a href="<?php echo get_permalink($miscevent->ID); ?>" class="url"><?php echo get_the_title($miscevent->ID); ?></a></span>
</li>
<?php endforeach; ?>
</ul>
</li>
<?php endif; ?>
<li class="more-events-link">
<?= component('button_link', array(
'href' => get_post_type_archive_link('colloquium'),
'html' => '<p>See all upcoming events »</p>'
)) ?>
</li>
</ul>
</section> <!-- #fp-events -->
<?php endif;
$concerts_with_media = event_query(array(
'maxposts' => 3,
'post_type' => 'concert',
'has_av' => true
));
if (!empty($concerts_with_media)) {
$max_items = 3;
$items = 0;
foreach ($concerts_with_media as $post) {
while ($items < $max_items && have_rows('programme')) {
the_row();
$media_item = component('embed_card', array(
'post' => $post
));
if ($media_item) {
$media_items[] = $media_item;
$items++;
}
}
}
if (!empty($media_items)) {
echo '<section class="fp-section section--events"><h2>Latest Music</h2>';
echo component('responsive_card_list', array('cards' => $media_items));
$music_archive = get_page_by_path('music');
if ($music_archive) {
echo '<div class="more-events-link">';
echo component('button_link', array(
'href' => get_permalink($music_archive->ID),
'html' => '<p>Hear more music »</p>'
));
echo '</div>';
}
echo '</section>';
}
}
// Get composers names, photos and permalinks
$today = date('Ymd', strtotime('-1 day'));
$posts = get_posts(array(
'numberposts' => -1,
'post_type' => 'member',
'orderby' => 'title',
'order' => 'ASC',
'meta_query' => array(
'relation' => 'OR',
array(
'key' => 'dtend',
'value' => null
),
array(
'key' => 'dtend',
'value' => $today,
'type' => 'numeric',
'compare' => '>'
)
)
));
if ($posts) {
echo component('member_list', array(
"members" => $posts,
'classes' => array('bg-overlay')
));
}
// Display archive link
?>
<section id="fp-archive-link" class="fp-section fp-section--archive-link">
<div class="fp-archive-link">
<?= component('button_link', array(
'href' => get_post_type_archive_link('concert'),
'html' => '<h2>Archive</h2><p>' . get_field('front_page_archive_link_text', 'option') . '</p>'
)) ?>
</div>
</section>
</article>
<?php get_footer();
?>