Make WordPress Core

Ticket #29237: gallery-link-size.diff

File gallery-link-size.diff, 1.3 KB (added by cliffseal, 11 years ago)
  • wp-includes/media.php

    diff --git wp-includes/media.php wp-includes/media.php
    index 974aa79..f1f4574 100644
    function gallery_shortcode( $attr ) { 
    952952                'size'       => 'thumbnail',
    953953                'include'    => '',
    954954                'exclude'    => '',
    955                 'link'       => ''
     955                'link'       => '',
     956                'linksize'   => ''
    956957        ), $attr, 'gallery'));
    957958
    958959        $id = intval($id);
    function gallery_shortcode( $attr ) { 
    10471048
    10481049        $i = 0;
    10491050        foreach ( $attachments as $id => $attachment ) {
    1050                 if ( ! empty( $link ) && 'file' === $link )
    1051                         $image_output = wp_get_attachment_link( $id, $size, false, false );
    1052                 elseif ( ! empty( $link ) && 'none' === $link )
     1051                if ( ! empty( $link ) && 'file' === $link ) {
     1052                        if ( ! empty( $linksize ) ) {
     1053                                $image_src = wp_get_attachment_image_src( $id, $linksize );
     1054                                $image_output = "<a href='" . $image_src[0]. "'>" . wp_get_attachment_image( $id, $size, false ) . "</a>";
     1055                        } else {
     1056                                $image_output = wp_get_attachment_link( $id, $size, false, false );
     1057                        }
     1058                } elseif ( ! empty( $link ) && 'none' === $link ) {
    10531059                        $image_output = wp_get_attachment_image( $id, $size, false );
    1054                 else
     1060                } else {
    10551061                        $image_output = wp_get_attachment_link( $id, $size, true, false );
     1062                }
    10561063
    10571064                $image_meta  = wp_get_attachment_metadata( $id );
    10581065