Make WordPress Core

Changeset 31453


Ignore:
Timestamp:
02/13/2015 05:51:22 PM (12 years ago)
Author:
lancewillett
Message:

Bundled themes: replace array_shift() with current() for performance.

Props SergeyBiryukov, fixes #31260.

Location:
trunk/src/wp-content/themes
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentyeleven/content-gallery.php

    r25625 r31453  
    3737                                if ( $images ) :
    3838                                        $total_images = count( $images );
    39                                         $image = array_shift( $images );
     39                                        $image = current( $images );
    4040                        ?>
    4141                                <figure class="gallery-thumb">
  • trunk/src/wp-content/themes/twentyfourteen/functions.php

    r30866 r31453  
    331331                // or get the URL of the first image attachment.
    332332                else {
    333                         $next_attachment_url = get_attachment_link( array_shift( $attachment_ids ) );
     333                        $next_attachment_url = get_attachment_link( current( $attachment_ids ) );
    334334                }
    335335        }
  • trunk/src/wp-content/themes/twentyfourteen/inc/widgets.php

    r31250 r31453  
    150150                                                                                $post_thumbnail = get_the_post_thumbnail();
    151151                                                                        elseif ( $total_images > 0 ) :
    152                                                                                 $image          = array_shift( $images );
     152                                                                                $image          = current( $images );
    153153                                                                                $post_thumbnail = wp_get_attachment_image( $image, 'post-thumbnail' );
    154154                                                                        endif;
  • trunk/src/wp-content/themes/twentyten/loop.php

    r31266 r31453  
    7676                                        if ( $images ) :
    7777                                                $total_images = count( $images );
    78                                                 $image = array_shift( $images );
     78                                                $image = current( $images );
    7979                                ?>
    8080                                                <div class="gallery-thumb">
  • trunk/src/wp-content/themes/twentythirteen/functions.php

    r31260 r31453  
    432432                // or get the URL of the first image attachment.
    433433                else
    434                         $next_attachment_url = get_attachment_link( array_shift( $attachment_ids ) );
     434                        $next_attachment_url = get_attachment_link( current( $attachment_ids ) );
    435435        }
    436436
Note: See TracChangeset for help on using the changeset viewer.