Allow gallery to be inserted with no links on the images. props chipbennett, helgatheviking, aaroncampbell, wonderboymusic. fixes #18178.
git-svn-id: https://develop.svn.wordpress.org/trunk@24550 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
3690db14f7
commit
bc4b7fd0a5
@ -353,6 +353,9 @@ function wp_print_media_templates() {
|
|||||||
<option value="file">
|
<option value="file">
|
||||||
<?php esc_attr_e('Media File'); ?>
|
<?php esc_attr_e('Media File'); ?>
|
||||||
</option>
|
</option>
|
||||||
|
<option value="none">
|
||||||
|
<?php esc_attr_e('None'); ?>
|
||||||
|
</option>
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
|
@ -778,7 +778,13 @@ function gallery_shortcode($attr) {
|
|||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach ( $attachments as $id => $attachment ) {
|
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 );
|
$image_meta = wp_get_attachment_metadata( $id );
|
||||||
|
|
||||||
$orientation = '';
|
$orientation = '';
|
||||||
@ -788,7 +794,7 @@ function gallery_shortcode($attr) {
|
|||||||
$output .= "<{$itemtag} class='gallery-item'>";
|
$output .= "<{$itemtag} class='gallery-item'>";
|
||||||
$output .= "
|
$output .= "
|
||||||
<{$icontag} class='gallery-icon {$orientation}'>
|
<{$icontag} class='gallery-icon {$orientation}'>
|
||||||
$link
|
$image_output
|
||||||
</{$icontag}>";
|
</{$icontag}>";
|
||||||
if ( $captiontag && trim($attachment->post_excerpt) ) {
|
if ( $captiontag && trim($attachment->post_excerpt) ) {
|
||||||
$output .= "
|
$output .= "
|
||||||
|
Loading…
x
Reference in New Issue
Block a user