forked from thicolares/TEDxTheme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sidebar-speaker.php
32 lines (29 loc) · 1.2 KB
/
sidebar-speaker.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
<div id="sidebar">
<?php
$year = get_theme_mod('promoted_speaker_year', date('Y'));
global $SpeakerPostType;
$related_videos = $SpeakerPostType->get_speakers_for($year, array('limit' => 3, 'exclude' => true));
?>
<h2>Related Speakers</h2>
<div class="row">
<?php foreach ($related_videos->posts as $post): setup_postdata($post); ?>
<div class="col-xs-12 related-speaker-tile">
<a href="<?php the_permalink(); ?>" class="video-thumb">
<?php
$video_id = get_post_meta($post->ID, '_speaker_video_id', true);
if (empty($video_id)) {
$video_thumb_src = get_template_directory_uri() . '/images/defaults/video-placeholder.jpg';
} else {
$video_thumb_src = "http://img.youtube.com/vi/$video_id/0.jpg";
}
?>
<img src="<?= $video_thumb_src; ?>">
</a>
<div class="media-type">Intro Video</div>
<div class="related-speaker-name"><p><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></p></div>
<div class="related-speaker-position"><?= str_replace(array("<p>", "</p>"), "", get_the_excerpt()); ?></div>
<hr>
</div>
<?php endforeach; ?>
</div>
</div>