Skip to content

Instantly share code, notes, and snippets.

@ebinnion
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ebinnion/237e8178216e5c79afd3 to your computer and use it in GitHub Desktop.
Save ebinnion/237e8178216e5c79afd3 to your computer and use it in GitHub Desktop.
Crane|WEST Slideshow CPT Snippet with Aqua Resizer
<?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