Make WordPress Core

Ticket #11725: 11725.4.patch

File 11725.4.patch, 2.1 KB (added by mintindeed, 12 years ago)
  • wp-includes/media.php

     
    802802                'columns'    => 3,
    803803                'size'       => 'thumbnail',
    804804                'include'    => '',
    805                 'exclude'    => ''
     805                'exclude'    => '',
     806                'start'      => 1,
     807                'count'      => -1,
    806808        ), $attr));
    807809
    808810        $id = intval($id);
     811        $start = intval($start);
     812        $count = intval($count);
    809813        if ( 'RAND' == $order )
    810814                $orderby = 'none';
    811815
    812816        if ( !empty($include) ) {
    813817                $include = preg_replace( '/[^0-9,]+/', '', $include );
    814                 $_attachments = get_posts( array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );
     818                $_attachments = get_posts( array( 'include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby, 'offset' => $start-1, 'numberposts' => $count ) );
    815819
    816820                $attachments = array();
    817821                foreach ( $_attachments as $key => $val ) {
     
    819823                }
    820824        } elseif ( !empty($exclude) ) {
    821825                $exclude = preg_replace( '/[^0-9,]+/', '', $exclude );
    822                 $attachments = get_children( array('post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );
     826                $attachments = get_children( array( 'post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby, 'offset' => $start-1, 'numberposts' => $count ) );
    823827        } else {
    824                 $attachments = get_children( array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );
     828                $attachments = get_children( array( 'post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby, 'offset' => $start-1, 'numberposts' => $count ) );
    825829        }
    826830
    827831        if ( empty($attachments) )