Make WordPress Core

Ticket #37227: 37227-twentyfourteen.diff

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

Patch for twentyfourteen

  • twentyfourteen/functions.php

     
    319319
    320320        // If there is more than 1 attachment in a gallery...
    321321        if ( count( $attachment_ids ) > 1 ) {
    322                 foreach ( $attachment_ids as $attachment_id ) {
     322                foreach ( $attachment_ids as $idx => $attachment_id ) {
    323323                        if ( $attachment_id == $post->ID ) {
    324                                 $next_id = current( $attachment_ids );
     324                                $next_id = $attachment_ids[ ( $idx + 1 ) % count( $attachment_ids ) ];
    325325                                break;
    326326                        }
    327327                }