-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsingle-professor.php
80 lines (70 loc) · 2.51 KB
/
single-professor.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
<?php get_header(); ?>
<?php
while(have_posts()) {
the_post();
get_template_part("template-parts/single-banner")?>
<div class="metabox section-width">
<?php $homePage = get_page_by_title("Home Page");?>
<a class="metabox-item metabox-link--home" href="<?php echo get_permalink($homePage->ID); ?>"><i class="fa fa-home" aria-hidden="true"></i> Home</a>
<?php $professorsPage = get_page_by_title("Professors");?>
<a class="metabox-item metabox-link--parent" href="<?php echo get_permalink($professorsPage->ID); ?>"><i class="far fa-arrow-alt-circle-left" aria-hidden="true"></i> All Professors</a>
</div>
<?php get_template_part("template-parts/single-post-content"); ?>
<section class="related-subjects section-width">
<?php
$relatedSubjects = get_field("related_subjects");
if ($relatedSubjects) { ?>
<h2>Subjects Taught</h2>
<?php foreach($relatedSubjects as $subject) { ?>
<div class="post-item post-item--subjects">
<h3><a href="<?php echo get_the_permalink($subject); ?>"><?php echo get_the_title($subject); ?></a></h3>
</div>
<?php }
}
?>
</section>
<section class="related-events section-width">
<?php
$today = date("Ymd");
$homepageEvents = new WP_Query(array(
"posts_per_page" => -1,
"post_type" => "event",
"meta_key" => "event_date",
"orderby" => "meta_value_num",
"order" => "ASC",
"meta_query" => array(
array(
"key" => "event_date",
"compare" => ">=",
"value" => $today,
"type" => "numeric"
),
array(
"key" => "related_professors",
"compare" => "LIKE",
"value" => '"' . get_the_ID() . '"',
)
)
));
if($homepageEvents->have_posts()) { ?>
<hr class="section-break">
<h2>Upcoming Events</h2>
<?php while($homepageEvents->have_posts()) {
$homepageEvents->the_post();
get_template_part("template-parts/event", "summary"); ?>
<hr class="section-break">
<?php }
} else { ?>
<hr class="section-break">
<h2>No Upcoming Events</h2>
<hr class="section-break">
<?php }
?>
</section>
<?php wp_reset_postdata();?>
<?php
comments_template();
?>
<?php }
?>
<?php get_footer(); ?>