[wp-trac] [WordPress Trac] #17214: Modification to Gallery

WordPress Trac wp-trac at lists.automattic.com
Fri Apr 22 15:34:33 UTC 2011


#17214: Modification to Gallery
-------------------------+-----------------------------
 Reporter:  dhmorris88   |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Media        |    Version:  3.1
 Severity:  minor        |   Keywords:
-------------------------+-----------------------------
 I recently came across this in a project and was astonished that this
 simple feature was not included: the ability to make modifications to the
 native gallery shortcode functionality.  Maybe I am just completed out of
 line, but I think it should be easy for a developer to make simple changes
 to the default gallery that comes with wordpress.  One of the features I
 needed was the ability to make random gallery from the attachments and
 limit them to a certain number.  Yes there is a order=rand feature, but no
 limit -- very frustrating.

 I added a couple of lines to the media script in includes, knowing that as
 soon as WP updates its gonna wipe out what I did.  So better yet this code
 should be included in the next update.

 Here is what I added to media.php:

 {{{
 785 'include'    => '',
 786 'exclude'    => '',
 787 'limit'      => ''
 }}}

 {{{
 796 $_attachments = get_posts( array('include' => $include, 'post_status'
 => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image',
 'order' => $order, 'orderby' => $orderby,  'numberposts' => $limit) );
 }}}

 {{{
 804 $attachments = get_children( array('post_parent' => $id, 'exclude' =>
 $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment',
 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby,
 'numberposts' => $limit) );
 }}}

 {{{
 806 $attachments = get_children( array('post_parent' => $id, 'post_status'
 => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image',
 'order' => $order, 'orderby' => $orderby, 'numberposts' => $limit) );
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/17214>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list