Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?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