WordPress.org

Make WordPress Core

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

File shortcode-gallery-limit-parameter.patch, 1.6 KB (added by nboehr, 7 years ago)
  • wp-includes/media.php

     
    730730 *     @type string $exclude    A comma-separated list of IDs of attachments to exclude. Default empty.
    731731 *     @type string $link       What to link each image to. Default empty (links to the attachment page).
    732732 *                              Accepts 'file', 'none'.
     733 *     @type string $limit      The maximum number of images to display. Has no effect, if either ids,
     734 *                              include or empty are specified. To display all images, use -1.
    733735 * }
    734736 * @return string HTML content to display gallery.
    735737 */
     
    781783                'size'       => 'thumbnail',
    782784                'include'    => '',
    783785                'exclude'    => '',
    784                 'link'       => ''
     786                'link'       => '',
     787                'limit'      => -1
    785788        ), $attr, 'gallery'));
    786789
    787790        $id = intval($id);
     
    798801        } elseif ( !empty($exclude) ) {
    799802                $attachments = get_children( array('post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );
    800803        } else {
    801                 $attachments = get_children( array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );
     804                $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) );
    802805        }
    803806
    804807        if ( empty($attachments) )