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
This commit is contained in:
parent
f6ca108240
commit
66054d7ffe
|
@ -353,6 +353,9 @@ function wp_print_media_templates() {
|
|||
<option value="file">
|
||||
<?php esc_attr_e('Media File'); ?>
|
||||
</option>
|
||||
<option value="none">
|
||||
<?php esc_attr_e('None'); ?>
|
||||
</option>
|
||||
</select>
|
||||
</label>
|
||||
|
||||
|
|
|
@ -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
|
||||
</{$icontag}>";
|
||||
if ( $captiontag && trim($attachment->post_excerpt) ) {
|
||||
$output .= "
|
||||
|
|
Loading…
Reference in New Issue