-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathepisode-people.php
executable file
·70 lines (56 loc) · 1.71 KB
/
episode-people.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
<?php
$who_ids = C::get_people_ids();
if ( count($who_ids) <= 0 ) return;
// if there are no people set (or found), skip this setup
// we leave the main loop from here temporarily
$args = array(
'post__in' => $who_ids, // round about
// luckily, this filters out multiple entries
'post_type' => array('person')
);
$query = new WP_Query($args);
?>
<div class="people">
<h3>In This Episode</h3>
<div>
<?php
$no_gravatar = array();
while ( $query->have_posts() ): $query->the_post();
$person_name = get_the_title();
$person_gravatar = C::get_person_gravatar_raw();
/*
Save any Person with an empty $gravatar.
*/
if ( '' == trim($person_gravatar) ) {
$no_gravatar[] = $post;
continue;
}
?>
<div class="person promo">
<div class="avatar"><a href="<?php the_permalink(); ?>"><?php echo C::get_person_gravatar(75); ?></a></div>
<div class="name"><a href="<?php the_permalink(); ?>"><?php echo $person_name; ?></a></div>
</div>
<?php endwhile; ?>
</div>
<br class="clearfix" />
<?php if ( sizeof($no_gravatar) > 0 ): ?>
<div class="auxillary-people">
<?php
/*
Displays any Person without a gravatar in a single comma deliminated list with an "and" for the last element.
*/
$alterted = array();
global $post;
foreach ($no_gravatar as $post) {
setup_postdata( $post );
$alterted[] = '<span class="name"><a href="'.get_permalink().'">'.get_the_title().'</a></span>';
}
?>
<p>Along with <?php echo _implode_and($alterted); ?>.</p>
</div>
<?php endif; ?>
</div>
<?php
// restores the main loop
wp_reset_postdata();
?>