-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsingle-event.php
executable file
·58 lines (52 loc) · 1.52 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
<?php
/**
* The Template for displaying all single posts
*/
get_header();
if ( have_posts() ) :
while ( have_posts() ) : the_post();
?>
<div id="primary" class="wrap group">
<div class="event content-wide" role="main">
<div class="group">
<div class="two-third entry-content">
<?php
global $post;
$post_id = $post->ID;
?>
<h1><?php the_title(); ?></h1>
<?php
$all_day = get_cmb_value( 'event_all_day' );
$is_all_day = ( $all_day == 'on' ? true : false );
// display event date
if ( has_cmb_value( 'event_start' ) && has_cmb_value( 'event_end' ) ) {
$start = get_cmb_value( 'event_start' );
$end = get_cmb_value( 'event_end' );
if ( date( 'Ymd', $start ) != date( 'Ymd', $end ) ) {
print "<h4>" . date( "F jS g:i a", $start ) . " - ";
print date( "F jS g:i a", $end ) . ( has_cmb_value( 'event_location' ) ? " @ " . get_cmb_value( 'event_location' ) : '' ) . "</h4>";
} else {
print "<h4>" . date( "F jS", $start ) . ( !$is_all_day ? ': ' . date( "g:i a", $start ) . " - " . date( "g:i a", $end ) : '' ) . ( has_cmb_value( 'event_location' ) ? " @ " . get_cmb_value( 'event_location' ) : '' ) . "</h4>";
}
}
?>
<?php the_content(); ?>
<hr>
<h2>Upcoming Events</h2>
<?php
print do_shortcode( '[events /]' );
?>
</div>
<div class="third event-image">
<?php the_post_thumbnail(); ?>
</div>
</div>
</div>
</div>
<?php
endwhile;
endif;
?>
<?php
get_footer();
?>