-
Notifications
You must be signed in to change notification settings - Fork 0
/
page-events.php
157 lines (139 loc) · 4.33 KB
/
page-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
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
<?php
/**
* Template Name: Events
*
* Please see /external/starkers-utilities.php for info on Starkers_Utilities::get_template_parts()
*
* @package WordPress
* @subpackage Starkers
* @since Starkers 4.0
*/
?>
<?php get_header();?>
<?php if ( have_posts() ): ?>
<?php while ( have_posts() ) : the_post(); ?>
<div class="container full">
<div class="row md-bottom">
<div class="col-md-8 col-md-offset-2 text-center">
<h1 class="category-title"><?php the_title(); ?></h1>
<h5 class="category-description"><?php the_content(); ?></h5>
</div>
</div>
</div>
<?php endwhile; ?>
<?php endif; ?>
<div class="container xs-m-t-3">
<div class="row md-bottom">
<div class="col-sm-12">
<hr/>
<h3 class="section-title">Upcoming</h3>
</div>
</div>
</div>
<div class="container">
<div class="row">
<?php
$current_timestamp = current_time('timestamp');
$args = array(
'post_type' => array('event'),
'posts_per_page' => -1,
'order' => 'DESC'
);
$upcoming_events_query = new WP_Query( $args );
$rowCounter = 0;
if( $upcoming_events_query->have_posts() ) {
while( $upcoming_events_query->have_posts() ){
$upcoming_events_query->the_post();
$end_date_field = get_field('end_date');
if ($end_date_field >= $current_timestamp) {
?>
<article <?php post_class( 'col-md-4 xs-m-b-3 md-m-b-3 xs-m-t-3 md-m-t-3' ); ?>>
<span class="borough-badge"><?php $categories = get_the_category();
if ( ! empty( $categories ) ) {
echo $categories[0]->name;
}
?></span>
<h6 class="event-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h6>
<div class="secondary-type xs-m-b-1"><?php the_field( 'subtitle'); ?></div>
<div class="news-event-meta">
<span class="small-header">When</span>
<div class="event-data xs-m-b-1">
<?php the_field( 'exact_date'); ?>
</div>
<span class="small-header">Where</span>
<div class="event-data">
<?php the_field( 'address'); ?>
</div>
</div>
</article>
<?php
$rowCounter++;
if($rowCounter==3){
echo('</div><div class="row">');//new row at 3rd post.
$rowCounter = 0;
}
}
}
}
wp_reset_query();
?>
</div>
</div>
<div class="container xs-m-t-6">
<div class="row md-bottom">
<div class="col-sm-12">
<hr/>
<h3 class="section-title">Past</h3>
</div>
</div>
</div>
<div class="container">
<div class="row">
<?php
$current_timestamp = current_time('timestamp');
$args = array(
'post_type' => array('event'),
'posts_per_page' => -1,
'order' => 'DESC'
);
$upcoming_events_query = new WP_Query( $args );
$rowCounter = 0;
if( $upcoming_events_query->have_posts() ) {
while( $upcoming_events_query->have_posts() ){
$upcoming_events_query->the_post();
$end_date_field = get_field('end_date');
if ($end_date_field < $current_timestamp) {
?>
<article <?php post_class( 'col-md-4 xs-m-b-3 md-m-b-3 xs-m-t-3 md-m-t-3' ); ?>>
<span class="borough-badge"><?php $categories = get_the_category();
if ( ! empty( $categories ) ) {
echo $categories[0]->name;
}
?></span>
<h6 class="event-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h6>
<div class="secondary-type xs-m-b-1"><?php the_field( 'subtitle'); ?></div>
<div class="news-event-meta">
<span class="small-header">When</span>
<div class="event-data xs-m-b-1">
<?php the_field( 'exact_date'); ?>
</div>
<span class="small-header">Where</span>
<div class="event-data">
<?php the_field( 'address'); ?>
</div>
</div>
</article>
<?php
$rowCounter++;
if($rowCounter==3){
echo('</div><div class="row">');//new row at 3rd post.
$rowCounter = 0;
}
}
}
}
wp_reset_query();
?>
</div>
</div>
<?php get_footer();?>