forked from ejohann/fictional-university-theme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsingle-professor.php
76 lines (64 loc) · 2.53 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
<?php
get_header();
while(have_posts()){
the_post();
pageBanner();
?>
<div class="container container--narrow page-section">
<div class="generic-content">
<div class="row group">
<div class="one-third"><?php the_post_thumbnail('professorPortrait'); ?></div>
<div class="two-thirds">
<?php
$likeCount = new WP_Query(array(
'post_type' => 'like',
'meta_query' => array(
array(
'key' => 'liked_professor_id',
'compare' => '=',
'value' => get_the_ID()
)
)
));
$existStatus = 'no';
if(is_user_logged_in())
{
$existsQuery = new WP_Query(array(
'author' => get_current_user_id(),
'post_type' => 'like',
'meta_query' => array(
array(
'key' => 'liked_professor_id',
'compare' => '=',
'value' => get_the_ID()
)
)
));
if($existsQuery->found_posts){$existStatus = 'yes';}
}
?>
<span class="like-box" data-like="<?php echo $existsQuery->posts[0]->ID; ?>" data-professor="<?php the_ID(); ?>" data-exists="<?php echo $existStatus; ?>">
<i class="fa fa-heart-o" aria-hidden="true"></i>
<i class="fa fa-heart" aria-hidden="true"></i>
<span class="like-count"><?php echo $likeCount->found_posts; ?></span>
</span>
<?php the_content(); ?>
</div>
</div>
</div>
<?php $relatedPrograms = get_field('related_programs'); ?>
<?php if($relatedPrograms) : ?>
<hr class="section-break">
<h2 class="headline headline--medium">Subject(s) Taught</h2>
<ul class="link-list min-list">
<?php
foreach($relatedPrograms as $program)
{ ?>
<li><a href="<?php echo get_the_permalink($program); ?>"><?php echo get_the_title($program); ?></a></li>
<?php } ?>
</ul>
<?php endif; ?>
</div>
<?php }
get_footer();
?>