Skip to content

Instantly share code, notes, and snippets.

@mikemcalister
Created January 13, 2015 17:34
Show Gist options
  • Save mikemcalister/228af6f96433e6557c3f to your computer and use it in GitHub Desktop.
Save mikemcalister/228af6f96433e6557c3f to your computer and use it in GitHub Desktop.
<?php // image gallery content
if( has_shortcode( $post->post_content, 'gallery' ) ) {
// Grab the first gallery in the post
$gallery = get_post_gallery_images( $post->ID );
$image_list = '<div class="owl-carousel">';
// Loop through each image in each gallery
foreach( $gallery as $image ) {
$image_list .= '<div><img src=" ' . $image . ' " /></div>';
}
$image_list .= '</div>';
// Display gallery
echo $image_list;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment