Ok, so, I found this function, but it wasn’t in the codex. It came from Pippin’s Plugins, just to clarify for any future readers.
It appears this function was used as a filter added onto the content, and will only run when filtering existing content, because it’s retrieving & replacing the galleries placed inside the post content.
So, I’d recommend adding the filter back on, and not using outside of the main content, here’s a reworked version of the function repurposed for your slider.
function pw_show_gallery_image_urls( $content ) {
global $post;
// Only do this on singular items
if( ! is_singular() )
return $content;
// Make sure the post has a gallery in it
if( ! has_shortcode( $post->post_content, 'gallery' ) )
return $content;
// Retrieve all galleries of this post
$galleries = get_post_galleries_images( $post );
// Loop through all galleries found
foreach( $galleries as $gallery ) {
$image_list = array();
// Loop through each image in each gallery
foreach( $gallery as $image ) {
$image_list[] = '<div><img src="' . $image . '" ></div>';
}
// Append our image list to the content of our post
if ( !empty( $image_list ) {
$content .= '<div class="slider">' . implode('', $image_list) . '</div>';
}
}
return $content;
}
add_filter( 'the_content', 'pw_show_gallery_image_urls' );
If this doesn’t work the way you want it to, though, you might have to find a different function to start from, or write it from scratch.