WordPress.org

Make WordPress Core


Ignore:
Timestamp:
12/09/2012 07:54:23 PM (7 years ago)
Author:
ryan
Message:

Introduce previous_image_link and next_image_link filters. Allows customizing the gallery display order.

Props nacin
fixes #22829 for trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/media.php

    r23105 r23139  
    837837    $k = $prev ? $k - 1 : $k + 1;
    838838
    839     if ( isset($attachments[$k]) )
    840         echo wp_get_attachment_link($attachments[$k]->ID, $size, true, false, $text);
     839    $output = $attachment_id = null;
     840    if ( isset( $attachments[ $k ] ) ) {
     841        $attachment_id = $attachments[ $k ]->ID;
     842        $output = wp_get_attachment_link( $attachment_id, $size, true, false, $text );
     843    }
     844
     845    $adjacent = $prev ? 'previous' : 'next';
     846    echo apply_filters( "{$adjacent}_image_link", $output, $attachment_id, $size, $text );
    841847}
    842848
Note: See TracChangeset for help on using the changeset viewer.