This repository was archived by the owner on Mar 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpage-speaking.php
78 lines (74 loc) · 2.07 KB
/
page-speaking.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
<?php
/*
Template Name: Speaking
*/
?>
<?php get_header(); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<div class="u-container u-section">
<h1><?php the_title(); ?></h1>
<?php the_content(); ?>
</div>
<div class="u-container u-section">
<?php
$args = array(
'post_type' => 'speaking',
'posts_per_page' => -1,
'meta_key' => 'date',
'orderby' => 'meta_value_num',
'order' => 'DESC'
);
$pasteventTitle = 0;
$upcomingTitle = 0;
$pastevents = new WP_Query( $args );
if ( $pastevents->have_posts() ) : while ( $pastevents->have_posts() ) : $pastevents->the_post(); ?>
<?php
$talk = get_field('talk');
$date = get_field('date');
if($date > date('Ymd') && $pasteventTitle === 0) :
echo '<h2>Upcoming events</h2>';
$upcomingTitle = 1;
endif;
if($date < date('Ymd') && $pasteventTitle === 0) :
if($upcomingTitle === 0) :
echo '<h2>Upcoming events</h2><p>No upcoming events.</p>';
endif;
echo '</div><div class="grid g-two-up g-limit g-gutter-x u-section"><div><h2>Past events</h2>';
$pasteventTitle = 1;
endif;
?>
<p><strong><?php the_title(); ?></strong><br />
<a href="<?php echo get_the_permalink($talk->ID); ?>"><?php echo $talk->post_title; ?></a>
</p>
<?php
endwhile; endif;
wp_reset_query();
?>
</div>
<div>
<h2>Talks</h2>
<ul class="u-list-unstyled">
<?php
$args = array(
'post_type' => 'talk',
'posts_per_page' => -1,
'orderby' => 'title',
'order' => 'ASC'
);
$talks = new WP_Query( $args );
if ( $talks->have_posts() ) : while ( $talks->have_posts() ) : $talks->the_post(); ?>
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php
endwhile; endif;
wp_reset_query();
?>
</ul>
</div>
</div>
<?php endwhile; else : ?>
<div class="u-container">
<h1>Not Found</h1>
<p>Sorry, but you are looking for something that isn't here.</p>
</div>
<?php endif; ?>
<?php get_footer(); ?>