Last active
August 29, 2015 14:01
-
-
Save ebinnion/237e8178216e5c79afd3 to your computer and use it in GitHub Desktop.
Crane|WEST Slideshow CPT Snippet with Aqua Resizer
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 | |
$slides = new WP_Query( | |
array( | |
'post_type' => 'slideshow', | |
'posts_per_page' => -1, | |
'orderby' => 'menu_order', | |
'order' => 'asc', | |
) | |
); | |
$captions = ''; | |
if ( $slides->have_posts() ) : | |
echo '<div class="small-12 columns slideshow">'; | |
echo '<div id="slider" class="nivoSlider">'; | |
while( $slides->have_posts() ) : $slides->the_post(); | |
$caption = get_post_meta( $post->ID, '_slideshow_caption', true ); | |
$image = wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); | |
$title = get_the_title(); | |
$resized = aq_resize( $image, 950, 325, true, true, true ); | |
if( !empty( $caption ) ): | |
echo "<img src='{$resized}' alt='$title' title='#slide-{$post->ID}'>"; | |
$captions .= '<div class="nivo-html-caption" id="slide-'. $post->ID.'"><h3>'.$title.'</h3>'. wpautop($caption) .'</div>'; | |
else: | |
echo "<img src='{$resized}' alt='$title'>"; | |
endif; | |
endwhile; | |
echo '</div></div>'; | |
if( !empty($captions) ) echo $captions; | |
endif; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment