From 66054d7ffe150164879ee251eb5dcdf338ac92b2 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Wed, 3 Jul 2013 20:43:19 +0000 Subject: [PATCH] Allow gallery to be inserted with no links on the images. props chipbennett, helgatheviking, aaroncampbell, wonderboymusic. fixes #18178. git-svn-id: http://core.svn.wordpress.org/trunk@24550 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/media-template.php | 3 +++ wp-includes/media.php | 10 ++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/wp-includes/media-template.php b/wp-includes/media-template.php index 15f2173d1f..0f53494bb0 100644 --- a/wp-includes/media-template.php +++ b/wp-includes/media-template.php @@ -353,6 +353,9 @@ function wp_print_media_templates() { + diff --git a/wp-includes/media.php b/wp-includes/media.php index be7d099607..9d43a65446 100644 --- a/wp-includes/media.php +++ b/wp-includes/media.php @@ -778,7 +778,13 @@ function gallery_shortcode($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); + if ( ! empty( $attr['link'] ) && 'file' === $attr['link'] ) + $image_output = wp_get_attachment_link( $id, $size, false, false ); + elseif ( ! empty( $attr['link'] ) && 'none' === $attr['link'] ) + $image_output = wp_get_attachment_image( $id, $size, false ); + else + $image_output = wp_get_attachment_link( $id, $size, true, false ); + $image_meta = wp_get_attachment_metadata( $id ); $orientation = ''; @@ -788,7 +794,7 @@ function gallery_shortcode($attr) { $output .= "<{$itemtag} class='gallery-item'>"; $output .= " <{$icontag} class='gallery-icon {$orientation}'> - $link + $image_output "; if ( $captiontag && trim($attachment->post_excerpt) ) { $output .= "