WordPress.org

Make WordPress Core

Changeset 23140


Ignore:
Timestamp:
12/09/12 20:07:57 (17 months ago)
Author:
ryan
Message:

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

Props nacin
fixes #22829 for 3.5

Location:
branches/3.5
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/3.5

  • branches/3.5/wp-includes/media.php

    r23105 r23140  
    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.