mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
Bundled themes: replace array_shift() with current() for performance.
Props SergeyBiryukov, fixes #31260. git-svn-id: https://develop.svn.wordpress.org/trunk@31453 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
487d65ad78
commit
27ed2ce07c
@ -36,7 +36,7 @@
|
||||
$images = twentyeleven_get_gallery_images();
|
||||
if ( $images ) :
|
||||
$total_images = count( $images );
|
||||
$image = array_shift( $images );
|
||||
$image = current( $images );
|
||||
?>
|
||||
<figure class="gallery-thumb">
|
||||
<a href="<?php the_permalink(); ?>"><?php echo wp_get_attachment_image( $image, 'thumbnail' ); ?></a>
|
||||
|
||||
@ -330,7 +330,7 @@ function twentyfourteen_the_attached_image() {
|
||||
|
||||
// or get the URL of the first image attachment.
|
||||
else {
|
||||
$next_attachment_url = get_attachment_link( array_shift( $attachment_ids ) );
|
||||
$next_attachment_url = get_attachment_link( current( $attachment_ids ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -149,7 +149,7 @@ class Twenty_Fourteen_Ephemera_Widget extends WP_Widget {
|
||||
if ( has_post_thumbnail() ) :
|
||||
$post_thumbnail = get_the_post_thumbnail();
|
||||
elseif ( $total_images > 0 ) :
|
||||
$image = array_shift( $images );
|
||||
$image = current( $images );
|
||||
$post_thumbnail = wp_get_attachment_image( $image, 'post-thumbnail' );
|
||||
endif;
|
||||
|
||||
|
||||
@ -75,7 +75,7 @@
|
||||
$images = twentyten_get_gallery_images();
|
||||
if ( $images ) :
|
||||
$total_images = count( $images );
|
||||
$image = array_shift( $images );
|
||||
$image = current( $images );
|
||||
?>
|
||||
<div class="gallery-thumb">
|
||||
<a class="size-thumbnail" href="<?php the_permalink(); ?>"><?php echo wp_get_attachment_image( $image, 'thumbnail' ); ?></a>
|
||||
|
||||
@ -431,7 +431,7 @@ function twentythirteen_the_attached_image() {
|
||||
|
||||
// or get the URL of the first image attachment.
|
||||
else
|
||||
$next_attachment_url = get_attachment_link( array_shift( $attachment_ids ) );
|
||||
$next_attachment_url = get_attachment_link( current( $attachment_ids ) );
|
||||
}
|
||||
|
||||
printf( '<a href="%1$s" title="%2$s" rel="attachment">%3$s</a>',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user