Avoid a PHP notice in bundled themes if no images were found.

props nabil_kadimi.
fixes #28361.

git-svn-id: https://develop.svn.wordpress.org/trunk@28585 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2014-05-27 10:54:54 +00:00
parent 06bf55f809
commit 9599dd9705
3 changed files with 5 additions and 3 deletions

View File

@ -57,9 +57,10 @@ get_header(); ?>
if ( $attachment->ID == $post->ID )
break;
}
$k++;
// If there is more than 1 attachment in a gallery
if ( count( $attachments ) > 1 ) {
$k++;
if ( isset( $attachments[ $k ] ) )
// get the URL of the next image attachment
$next_attachment_url = get_attachment_link( $attachments[ $k ]->ID );

View File

@ -71,9 +71,10 @@
if ( $attachment->ID == $post->ID )
break;
}
$k++;
// If there is more than 1 image attachment in a gallery
if ( count( $attachments ) > 1 ) {
$k++;
if ( isset( $attachments[ $k ] ) )
// get the URL of the next image attachment
$next_attachment_url = get_attachment_link( $attachments[ $k ]->ID );

View File

@ -58,9 +58,9 @@ foreach ( $attachments as $k => $attachment ) :
break;
endforeach;
$k++;
// If there is more than 1 attachment in a gallery
if ( count( $attachments ) > 1 ) :
$k++;
if ( isset( $attachments[ $k ] ) ) :
// get the URL of the next image attachment
$next_attachment_url = get_attachment_link( $attachments[ $k ]->ID );