Make WordPress Core

Ticket #37227: 37227-twentythirteen.diff

File 37227-twentythirteen.diff, 614 bytes (added by xknown, 9 years ago)

Patch for twentythirteen

  • twentythirteen/functions.php

     
    421421
    422422        // If there is more than 1 attachment in a gallery...
    423423        if ( count( $attachment_ids ) > 1 ) {
    424                 foreach ( $attachment_ids as $attachment_id ) {
     424                foreach ( $attachment_ids as $idx => $attachment_id ) {
    425425                        if ( $attachment_id == $post->ID ) {
    426                                 $next_id = current( $attachment_ids );
     426                                $next_id = $attachment_ids[ ( $idx + 1 ) % count( $attachment_ids ) ];
    427427                                break;
    428428                        }
    429429                }