-
Notifications
You must be signed in to change notification settings - Fork 0
/
single-program.php
87 lines (75 loc) · 2.7 KB
/
single-program.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
<?php get_header();
page_banner();
?>
<?php while(have_posts()):the_post(); ?>
<div class="container container--narrow page-section">
<div class="metabox metabox--position-up metabox--with-home-link">
<p><a class="metabox__blog-home-link" href="<?php echo get_post_type_archive_link('program');?>">
<i class="fa fa-home" aria-hidden="true"></i> Programs Home</a>
<span class="metabox__main"><?php the_time('M d, Y');?></span>
</p>
</div>
<div class="generic-content">
<?php the_content(); ?>
</div>
<?php
$professors = new WP_Query(array(
'post_type' => 'professor',
'posts_per_page' => -1,
'order' => 'ASC',
'orderby' => 'title',
'meta_query' => array(
array(
'key' => 'related_programs',
'compare' => 'LIKE',
'value' => '"'. get_the_ID() .'"',
),
)
));
if($professors->have_posts()):?>
<hr class="section-break">
<h3 class="headline headline--medium"><?php the_title(); ?> Professors:</h3>
<br>
<ul class="professor-cards">
<?php while($professors->have_posts()): $professors->the_post();?>
<li class="professor-card__list-item">
<a class="professor-card" href="<?php the_permalink(); ?>">
<img class="professor-card__image" src="<?php the_post_thumbnail_url('professor-landscape'); ?>">
<span class="professor-card__name"><?php the_title(); ?></span>
</a>
</li>
<?php endwhile;?>
</ul>
<?php endif; wp_reset_postdata(); ?>
<?php
$today = date('Ymd');
$events = new WP_Query(array(
'post_type' => 'event',
'posts_per_page' => 2,
'order' => 'ASC',
'orderby' => 'meta_value_num',
'meta_key' => 'event_date',
'meta_query' => array(
array(
'key' => 'event_date',
'compare' => '>=',
'value' => $today,
'type' => 'numeric'
),
array(
'key' => 'related_programs',
'compare' => 'LIKE',
'value' => '"'. get_the_ID() .'"',
),
)
));
if($events->have_posts()):?>
<hr class="section-break">
<h3 class="headline headline--medium">Upcoming Event(s):</h3>
<br>
<?php while($events->have_posts()): $events->the_post();
get_template_part( 'template-parts/content', 'event' );
endwhile; endif; wp_reset_postdata(); ?>
<div>
<?php endwhile; ?>
<?php get_footer(); ?>