Skip to content

Instantly share code, notes, and snippets.

@joedooley
Created October 18, 2015 18:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joedooley/3c6f74c1ff8a6725656d to your computer and use it in GitHub Desktop.
Save joedooley/3c6f74c1ff8a6725656d to your computer and use it in GitHub Desktop.
slick-slider
<?php
// WP_Query arguments for slide CPT
$args = array (
'post_type' => 'slide',
'posts_per_page' => '5'
);
// The Query
$query = new WP_Query( $args );
// The Loop
if ( $query->have_posts() ) {
echo '<div class="catering-slides">';
while ( $query->have_posts() ) {
$query->the_post();
echo '<div class="catering-slide">';
$image = the_post_thumbnail( 'large' );
printf( '<div class="slide-image"><a href="%s" rel="bookmark"><img src="%s"/></a></div>', get_permalink(), $image, the_title_attribute( 'echo=0' ) );
?>
<div class="catering-slide-caption">
<div class="catering-slide-excerpt">;
<h2><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>" class="slide-title"><?php the_title(); ?></a></h2>
<?php the_content(); ?>
</div>
</div>
</div>
<?php }
echo '</div>';
} else {
// no posts found
}
// Restore original Post Data
wp_reset_postdata();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment