This repository has been archived by the owner on Jan 21, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 73
/
archive-event.php
132 lines (109 loc) · 3.95 KB
/
archive-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
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
<?php
get_header();
$post = get_post(13174);
$content = apply_filters('the_content', $post->post_content);
?>
<article class="container">
<h1 class="headline-page">ownCloud Events</h1>
<?php echo $content; ?>
<?php
$today = date('Ymd');
$args = array(
'numberposts' => -1,
'post_type' => 'event',
'meta_key' => 'event_date_start',
'meta_query' => array(
array(
'key' => 'event_date_start',
'value' => $today,
'compare' => '>='
)
),
'orderby' => 'meta_value',
'order' => 'ASC'
);
$the_query = new WP_Query( $args );
?>
<?php if( $the_query->have_posts() ): ?>
<h2>Upcoming Events</h2>
<div class="isotope-grid">
<div class="grid-gutter"></div>
<div class="grid-sizer"></div>
<?php while( $the_query->have_posts() ) : $the_query->the_post();
if (get_field('event_external') !== '') {
$link = get_field('event_external');
$target = "_blank";
} else if (get_field('event_post') !== '') {
$link = get_permalink(get_field('event_post'));
$target = "";
} else {
$link = get_the_permalink();
$target = "";
}
?>
<a class="d-block post-preview grid-item" href="<?php echo $link; ?>" target="<?php echo $target; ?>">
<div class="overflow-hidden" href="<?php echo $link; ?>" target="<?php echo $target; ?>">
<?php
the_post_thumbnail('medium', array('class' => 'img-fluid'));
?>
</div>
<div class="content">
<h2><?php the_title(); ?></h2>
<p class="date"><?php echo get_field('event_date_start');
if (get_field('event_date_end') !== '')
echo ' - ' . get_field('event_date_end');
?></p>
</div>
</a>
<?php
endwhile; ?>
</div>
<?php
endif; ?>
<?php wp_reset_postdata();
$args = array(
'numberposts' => -1,
'post_type' => 'event',
'meta_key' => 'event_date_start',
'meta_query' => array(
array(
'key' => 'event_date_start',
'value' => $today,
'compare' => '<'
)
),
'orderby' => 'meta_value',
'order' => 'ASC'
);
// query
$the_query = new WP_Query( $args );
?>
<?php if( $the_query->have_posts() ): ?>
<h2>Past Events</h2>
<div class="isotope-grid">
<div class="grid-gutter"></div>
<div class="grid-sizer"></div>
<?php while( $the_query->have_posts() ) : $the_query->the_post(); ?>
<div class="grid-item">
<?php
if (get_field('event_external') !== '') {
echo '<a href="' . get_field('event_external') . '" target="_blank">';
} else if (get_field('event_post') !== '') {
echo '<a href="' . get_page_link(get_field('event_post')) . '">';
} else {
echo '<a href="' . get_the_permalink() . '">';
}
?><span class="smallfont"><?php
echo get_field('event_date_start');
if (get_field('event_date_end') !== '') {
echo ' - ' . get_field('event_date_end');
}
?></span><br />
<?php the_title(); ?></a>
</div>
<?php endwhile; ?>
<?php endif;
wp_reset_postdata(); ?>
</article>
<?php
get_footer();