-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtemplate-events.php
122 lines (88 loc) · 3.15 KB
/
template-events.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
<?php
/*
Template Name: Events Page
*/
get_header(); ?>
<div class="clear"></div>
</header> <!-- / END HOME SECTION -->
<div id="content" class="site-content">
<div class="container">
<div class="content-left-wrap col-md-12">
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php
echo '<h1 class="featured-title">'. __('Upcoming Events','openlab-txtd').'</h1>';
//get Next Event from now
$args = array(
'post_type' => 'event',
'posts_per_page' => 1,
'meta_key' => 'event_datetime_start',
'meta_value' => date( "U" ),
'meta_compare' => '>',
'orderby' => 'meta_value_num',
'order' => 'ASC'
);
$query = new WP_Query( $args );
while ( $query->have_posts() ) : $query->the_post();
echo '<div class="row upcoming-featured">';
echo '<div class="content-left-wrap col-md-3 col-sm-3 col-xs-3">';
get_template_part( 'content', 'event_meta_list_featured' );
echo '</div>';
echo '<div class="content-left-wrap col-md-9 col-sm-9 col-xs-9">';
get_template_part( 'content', 'event_list_featured' );
echo '</div>';
echo '</div>';
endwhile;
wp_reset_postdata();
//get Next 2 Events from now
$args = array(
'post_type' => 'event',
'posts_per_page' => 3,
'offset' => 1,
'meta_key' => 'event_datetime_start',
'meta_value' => date( "U" ),
'meta_compare' => '>',
'orderby' => 'meta_value_num',
'order' => 'ASC'
);
$query = new WP_Query( $args );
while ( $query->have_posts() ) : $query->the_post();
echo '<div class="row upcoming">';
echo '<div class="content-left-wrap col-md-3 col-sm-3 col-xs-3">';
get_template_part( 'content', 'event_meta_list' );
echo '</div>';
echo '<div class="content-left-wrap col-md-9 col-sm-9 col-xs-9">';
get_template_part( 'content', 'event_list' );
echo '</div>';
echo '</div>';
endwhile;
wp_reset_postdata();
//3 most recently Passed Events
echo '<h3 class="featured-title">'. __('Passed Events','openlab-txtd').'</h3>';
$args = array(
'post_type' => 'event',
'posts_per_page' => 3,
'meta_key' => 'event_datetime_end',
'meta_value' => date( "U" ),
'meta_compare' => '<',
'orderby' => 'meta_value_num',
'order' => 'DESC'
);
$query = new WP_Query( $args );
while ( $query->have_posts() ) : $query->the_post();
echo '<div class="row passed-events">';
echo '<div class="content-left-wrap col-md-3 col-sm-3 col-xs-3">';
get_template_part( 'content', 'event_meta_list' );
echo '</div>';
echo '<div class="content-left-wrap col-md-9 col-sm-9 col-xs-9">';
get_template_part( 'content', 'event_list' );
echo '</div>';
echo '</div>';
endwhile;
wp_reset_postdata();
?>
</main><!-- #main -->
</div><!-- #primary -->
</div><!-- .content-left-wrap -->
</div><!-- .container -->
<?php get_footer(); ?>