WordPress.org

Make WordPress Core

Ticket #27058: shortcode-gallery-limit-parameter-r28200.patch

File shortcode-gallery-limit-parameter-r28200.patch, 1.6 KB (added by nboehr, 7 years ago)

Patch for Revision 28200

  • media.php

     
    900900 *     @type string $exclude    A comma-separated list of IDs of attachments to exclude. Default empty.
    901901 *     @type string $link       What to link each image to. Default empty (links to the attachment page).
    902902 *                              Accepts 'file', 'none'.
     903 *     @type string $limit      The maximum number of images to display. Has no effect, if either ids,
     904 *                              include or empty are specified. To display all images, use -1.
    903905 * }
    904906 * @return string HTML content to display gallery.
    905907 */
     
    952954                'size'       => 'thumbnail',
    953955                'include'    => '',
    954956                'exclude'    => '',
    955                 'link'       => ''
     957                'link'       => '',
     958                'limit'      => -1
    956959        ), $attr, 'gallery'));
    957960
    958961        $id = intval($id);
     
    969972        } elseif ( !empty($exclude) ) {
    970973                $attachments = get_children( array('post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );
    971974        } else {
    972                 $attachments = get_children( array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );
     975                $attachments = get_children( array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby, 'posts_per_page' => $limit) );
    973976        }
    974977
    975978        if ( empty($attachments) )