Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Template Name: Gallery Page
- *
- */
- if ( have_posts() ) {
- while ( have_posts() ) {
- the_post();
- 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 the first gallery in the post
- $gallery = get_post_gallery_images( $post );
- $image_list = '<ul>';
- // Loop through each image in each gallery
- foreach( $gallery as $image_url ) {
- $image_list .= '<li>' . '<img src="' . $image_url . '">' . '</li>';
- }
- $image_list .= '</ul>';
- // Append our image list to the content of our post
- $content .= $image_list;
- return $content;
- }
- add_filter( 'the_content', 'pw_show_gallery_image_urls' );
- } // end while
- } // end if
- ?>
- 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 the first gallery in the post
- $gallery = get_post_gallery_images( $post );
- $image_list = '<ul>';
- // Loop through each image in each gallery
- foreach( $gallery as $image_url ) {
- $image_list .= '<li>' . '<img src="' . $image_url . '">' . '</li>';
- }
- $image_list .= '</ul>';
- // Append our image list to the content of our post
- $content .= $image_list;
- return $content;
- }
- add_filter( 'the_content', 'pw_show_gallery_image_urls' );
- if ( have_posts() ) {
- while ( have_posts() ) {
- the_post();
- } // end while
- } // end if
- if ( have_posts() ) {
- while ( have_posts() ) {
- the_post();
- the_content(); // minimum
- } // end while
- } // end if
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement