Skip to content

Commit

Permalink
Introduce previous_image_link and next_image_link filters. Allows cus…
Browse files Browse the repository at this point in the history
…tomizing the gallery display order.

Props nacin
fixes #22829 for 3.5


git-svn-id: http://core.svn.wordpress.org/branches/3.5@23140 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
Ryan Boren committed Dec 9, 2012
2 parents 749fb80 + fe8a8c9 commit 4dfc952
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions wp-includes/media.php
Original file line number Diff line number Diff line change
Expand Up @@ -836,8 +836,14 @@ function adjacent_image_link($prev = true, $size = 'thumbnail', $text = false) {

$k = $prev ? $k - 1 : $k + 1;

if ( isset($attachments[$k]) )
echo wp_get_attachment_link($attachments[$k]->ID, $size, true, false, $text);
$output = $attachment_id = null;
if ( isset( $attachments[ $k ] ) ) {
$attachment_id = $attachments[ $k ]->ID;
$output = wp_get_attachment_link( $attachment_id, $size, true, false, $text );
}

$adjacent = $prev ? 'previous' : 'next';
echo apply_filters( "{$adjacent}_image_link", $output, $attachment_id, $size, $text );
}

/**
Expand Down

0 comments on commit 4dfc952

Please sign in to comment.