WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to display all the images added as gallery in a post with prettyphoto class.

I am using this code.

        /* The loop */
        while ( have_posts() ) : the_post();
            if ( get_post_gallery() ) :
                $gallery = get_post_gallery( get_the_ID(), false );

             /* Loop through all the image and output them one by one */
                foreach( $gallery['src'] AS $src )

                 <a href="<?php echo $src; ?>" rel="prettyPhoto[pp_gal]"><img src="<?php echo $src; ?>"  alt="Gallery image"  /></a>


Its is displaying the photos but it is showing only thumbnail as src. I want to display Full Image.

How can i display full image instead of thumbnail ?

share|improve this question
work on your acceptance rate, if somebody gives you an answer which helps you to resolve your issue, then mark it as correct – Eugene Manuilov Oct 15 '13 at 11:32

TutsPlus did a pretty straightforward article on exactly this a while back. Perhaps you could give it a read and let us know if you run into any problems? This forum is good with problems. The basis of your question is more of a "point me at a tutorial" issue though. Done and done :)

You may need to refer to a code snip like this to get gallery integration though, once you've done the basics.

share|improve this answer

Try this

// Query the custom post type to display
$args = array('post_type' => 'CUSTOM POST TYPE');
$query = new WP_Query( $args );

if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post();
   // your gallery loop
endwhile; endif;
share|improve this answer
Please add an explanation to your answer: why could that solve the problem? – toscho Oct 15 '13 at 11:47

Read the documentation for get_post_gallery and you'll see that the function is intended to return thumbnail image sources. The function also returns a string IDs of images. So you can split it into array, and run wp_get_attachment_link within the same loop (with a defined index to reference correct image file ID) to query for full image source.

share|improve this answer

You can alter the foreach loop as follows,

 foreach( $gallery['ids'] as $attachment_id )
       $image_attributes = wp_get_attachment_image_src( $attachment_id );
       if( $image_attributes ) {

           $src = isset($image_attributes[0])? $image_attributes[0] : '';

            if(!empty($src)) {

             <a href="<?php echo $src; ?>" rel="prettyPhoto[pp_gal]"><img src="<?php echo $src; ?>"  alt="Gallery image"  /></a>


You can specify required dimension, as second parameter for , 'wp_get_attachment_image_src()' function.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.