-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsingle-event.php
65 lines (58 loc) · 1.75 KB
/
single-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
<?php
get_header();
if(have_posts()) : while(have_posts()) : the_post();
?>
<main class="event--single__top">
<div class="event--single__top__wrapper">
<h1 class="event--single__title"><span><?= the_title(); ?></span></h1>
<?php
$start = new DateTime(get_field('start_datetime'));
$start->setTimezone( new DateTimeZone('Europe/Amsterdam') );
$end = new DateTime(get_field('end_datetime'));
$end->setTimezone( new DateTimeZone('Europe/Amsterdam') );
$start_month = $start->format('F');
$start_day = $start->format('jS');
$end_month = $end->format('F');
$end_day = $end->format('jS');
$start_time = $start->format('H:i');
$end_time = $end->format('H:i');
$location_name = get_field('location_name');
$categories = get_the_category_list(' ');
?>
<div class="event--single__meta">
<?php
echo $start_month . ' ' . $start_day . ', '. $start_time . ' – ';
if ($start_day != $end_day){
echo $end_month . ' ' . $end_day . ', ' . $end_time;
} else {
echo $end_time;
}
echo ($location_name) ? ' @ ' . $location_name : ' ';
?>
</div>
<div class="event--single__categories">
<?=$categories;?>
</div>
<?php if ( has_post_thumbnail() ) : ?>
<div class="event--single__thumb">
<?php
the_post_thumbnail(
'large',
array('class' => 'event--single__img')
);
?>
</div>
<?php endif; ?>
</div>
</main>
<div class="event--single__wrapper">
<?php
if(!empty(get_field('facebook_url'))){?>
<a class="button button--facebook" href="<?= get_field('facebook_url')?>" target="_blank"><i class="fa fa-facebook"></i> Event Page</a>
<?php }
the_content(); ?>
</div>
<?php
endwhile; endif;
get_footer();
?>