Gallery Shortcode Fix

A quick fix for http://core.trac.wordpress.org/ticket/23298
N.B. images now link to the file as default
This commit is contained in:
Foxaii
2013-06-15 20:39:23 +02:00
parent 4cd6cea04d
commit c08712c720

View File

@@ -277,7 +277,8 @@ function roots_gallery($attr) {
'columns' => 3,
'size' => 'thumbnail',
'include' => '',
'exclude' => ''
'exclude' => '',
'link' => 'file'
), $attr));
$id = intval($id);
@@ -315,9 +316,9 @@ function roots_gallery($attr) {
$i = 0;
foreach ($attachments as $id => $attachment) {
$link = isset($attr['link']) && 'file' == $attr['link'] ? wp_get_attachment_link($id, $size, false, false) : wp_get_attachment_link($id, $size, true, false);
$image = ('file' == $link) ? wp_get_attachment_link($id, $size, false, false) : wp_get_attachment_link($id, $size, true, false);
$output .= '<li>' . $link;
$output .= '<li>' . $image;
if (trim($attachment->post_excerpt)) {
$output .= '<div class="caption hidden">' . wptexturize($attachment->post_excerpt) . '</div>';
}