Make WordPress Core

Ticket #29237: 29237.diff

File 29237.diff, 1.9 KB (added by iamfriendly, 9 years ago)

Refreshed the patch and added docs

  • wp-includes/media.php

    diff --git wp-includes/media.php wp-includes/media.php
    index e0ed8f4..c26103a 100644
    add_shortcode('gallery', 'gallery_shortcode'); 
    13861386 *     @type string $exclude    A comma-separated list of IDs of attachments to exclude. Default empty.
    13871387 *     @type string $link       What to link each image to. Default empty (links to the attachment page).
    13881388 *                              Accepts 'file', 'none'.
     1389 *     @type string $linksize   Size of the images to link to. A string keyword (thumbnail,
     1390 *                                              medium, large, or full) as allowed by wp_get_attachment_image_src().
     1391 *                                              Default empty.
    13891392 * }
    13901393 * @return string HTML content to display gallery.
    13911394 */
    function gallery_shortcode( $attr ) { 
    14351438                'size'       => 'thumbnail',
    14361439                'include'    => '',
    14371440                'exclude'    => '',
    1438                 'link'       => ''
     1441                'link'       => '',
     1442                'linksize'      => ''
    14391443        ), $attr, 'gallery' );
    14401444
    14411445        $id = intval( $atts['id'] );
    function gallery_shortcode( $attr ) { 
    15361540
    15371541                $attr = ( trim( $attachment->post_excerpt ) ) ? array( 'aria-describedby' => "$selector-$id" ) : '';
    15381542                if ( ! empty( $atts['link'] ) && 'file' === $atts['link'] ) {
    1539                         $image_output = wp_get_attachment_link( $id, $atts['size'], false, false, false, $attr );
     1543                        if ( ! empty( $atts['linksize'] ) ) {
     1544                                $image_src = wp_get_attachment_image_src( $id, $atts['linksize'] );
     1545                                $image_output = "<a href='" . $image_src[0]. "'>" . wp_get_attachment_image( $id, $atts['size'], false ) . '</a>';
     1546                        } else {
     1547                                $image_output = wp_get_attachment_link( $id, $atts['size'], false, false );
     1548                        }
     1549                        // $image_output = wp_get_attachment_link( $id, $atts['size'], false, false, false, $attr );
    15401550                } elseif ( ! empty( $atts['link'] ) && 'none' === $atts['link'] ) {
    15411551                        $image_output = wp_get_attachment_image( $id, $atts['size'], false, $attr );
    15421552                } else {