Created
November 19, 2012 21:10
-
-
Save taras/4113921 to your computer and use it in GitHub Desktop.
Show a list of videos associated to a comedian
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# save the current $post because we'll be overwriting it later | |
# we want to make sure he doesn't get lost | |
$comedian = $post; | |
# get the videos associated to this comedian | |
if ( $videos = get_field('featured_in_videos') ) : ?> | |
<div class="row"> | |
<h3>Comedian Videos</h3> | |
<?php | |
# iterate over the videos and setup $post variable for each video | |
# setup_postdata($post) allows us to use template functions while iterating through posts | |
foreach ( $videos as $post ) : setup_postdata($post); ?> | |
<div class="span4"> | |
<?php | |
# load specific template for every post | |
get_template_part('video', 'thumbnail'); ?> | |
</div> | |
<?php endforeach; ?> | |
</div> | |
<?php endif; | |
# reset the current post back to the comedian | |
$post = $comedian; | |
setup_postdata($post); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment