Ticket #12799: 12799.diff
| File 12799.diff, 2.4 KB (added by , 13 years ago) |
|---|
-
media.php
802 802 'columns' => 3, 803 803 'size' => 'thumbnail', 804 804 'include' => '', 805 'exclude' => '' 805 'exclude' => '', 806 'numberimages' => 0 806 807 ), $attr)); 807 808 808 809 $id = intval($id); 810 811 $numberimages = intval($numberimages); 812 if ( $numberimages <= 0 ) 813 $numberimages = -1; 814 809 815 if ( 'RAND' == $order ) 810 816 $orderby = 'none'; 811 817 812 818 if ( !empty($include) ) { 813 819 $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) );820 $_attachments = get_posts( array('include' => $include, 'numberposts' => $numberimages, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) ); 815 821 816 822 $attachments = array(); 817 823 foreach ( $_attachments as $key => $val ) { … … 819 825 } 820 826 } elseif ( !empty($exclude) ) { 821 827 $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) );828 $attachments = get_children( array('numberposts' => $numberimages, 'post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) ); 823 829 } else { 824 $attachments = get_children( array(' post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );830 $attachments = get_children( array('numberposts' => $numberimages, 'post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) ); 825 831 } 826 832 827 833 if ( empty($attachments) ) 828 834 return ''; 829 835 836 // Necessary because in get_posts(), when specifying include="", the numberposts parameter is ignored (it's set to match the number if items in include="") 837 if ( $numberimages > 0 ) 838 $attachments = array_slice( $attachments, 0, $numberimages, true ); 839 830 840 if ( is_feed() ) { 831 841 $output = "\n"; 832 842 foreach ( $attachments as $att_id => $attachment )