Make WordPress Core


Ignore:
Timestamp:
03/27/2013 08:37:34 PM (13 years ago)
Author:
lancewillett
Message:

Twenty Ten: improve how gallery image IDs are retrieved for use in the Gallery post format template. Props to obenland for original patch, fixes #23617.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-content/themes/twentyten/loop.php

    r23793 r23826  
    7171<?php else : ?>
    7272                <?php
    73                     $images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) );
     73                    $images = twentyten_get_gallery_images();
    7474                    if ( $images ) :
    7575                        $total_images = count( $images );
    7676                        $image = array_shift( $images );
    77                         $image_img_tag = wp_get_attachment_image( $image->ID, 'thumbnail' );
    7877                ?>
    7978                        <div class="gallery-thumb">
    80                             <a class="size-thumbnail" href="<?php the_permalink(); ?>"><?php echo $image_img_tag; ?></a>
     79                            <a class="size-thumbnail" href="<?php the_permalink(); ?>"><?php echo wp_get_attachment_image( $image, 'thumbnail' ); ?></a>
    8180                        </div><!-- .gallery-thumb -->
    8281                        <p><em><?php printf( _n( 'This gallery contains <a %1$s>%2$s photo</a>.', 'This gallery contains <a %1$s>%2$s photos</a>.', $total_images, 'twentyten' ),
     
    8483                                number_format_i18n( $total_images )
    8584                            ); ?></em></p>
    86                 <?php endif; ?>
     85                <?php endif; // end twentyten_get_gallery_images() check ?>
    8786                        <?php the_excerpt(); ?>
    8887<?php endif; ?>
Note: See TracChangeset for help on using the changeset viewer.