Created
April 10, 2012 05:31
-
-
Save robertcedwards/2348495 to your computer and use it in GitHub Desktop.
Nice lil' custom post type loop for li items using isotope
This file contains hidden or 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
<div id="sorter"> | |
<ul class="option-set selector"> | |
<li><a class="" href="#filter=*">View All</a></li> | |
<li><a class="" href="#filter=.commercial">Commercial</a></li> | |
<li><a class="" href="#filter=.music">Music</a></li> | |
<li><a class="" href="#filter=.live">Live</a></li> | |
<li><a class="" href="#filter=.web">Web</a></li> | |
<li><a class="" href="#filter=.editorial">editorial</a></li> | |
<li><a class="" href="#filter=.docu">Docu</a></li> | |
</ul> | |
</div> | |
<article <?php post_class() ?>> | |
<div class="entry videolist container"> | |
<?php $args = array( 'post_type' => 'video', 'posts_per_page' => 100 ); | |
$loop = new WP_Query( $args ); | |
while ( $loop->have_posts() ) : $loop->the_post(); | |
$terms = get_the_terms( $post->ID, 'Tags' ); | |
if ( $terms && ! is_wp_error( $terms ) ) : $video_tags = array(); | |
foreach ( $terms as $term ) {$video_tags[] = $term->name;} $class_names = join( ", ", $video_tags ); | |
endif; | |
echo '<div class="items '; | |
echo $class_names; | |
echo '">'; | |
echo '<a class="fancybox.iframe fancybox" href="'; | |
echo 'http://player.vimeo.com/video/'; | |
the_field('link_to_video'); | |
echo '/">'; | |
$url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); | |
echo '<img src="'; | |
echo $url; | |
echo '"/>'; | |
echo '<h4 class="video-title">'; | |
the_title(); | |
echo '</h4>'; | |
echo '</a>'; | |
echo '</div>'; | |
endwhile; ?> | |
</div> | |
</article> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment