[wp-trac] [WordPress Trac] #12799: Allow gallery shortcode to accept a maximum number of items

WordPress Trac wp-trac at lists.automattic.com
Sun Aug 26 23:05:40 UTC 2012


#12799: Allow gallery shortcode to accept a maximum number of items
---------------------------------------+-----------------------------
 Reporter:  dtorbert                   |       Owner:
     Type:  feature request            |      Status:  new
 Priority:  normal                     |   Milestone:  Future Release
Component:  Gallery                    |     Version:  2.9.2
 Severity:  normal                     |  Resolution:
 Keywords:  gallery maximum has-patch  |
---------------------------------------+-----------------------------
Changes (by jamescollins):

 * keywords:  gallery maximum => gallery maximum has-patch


Comment:

 {{{12799.diff}}} adds an optional {{{numberimages=""}}} parameter to the
 [gallery] shortcode.

 This parameter is named similarly to the {{{numberposts}}} attribute in
 {{{get_posts()}}}.

 If the {{{numberimages}}} parameter is set to a number greater than zero,
 then it controls the maximum number of images displayed by the [gallery]
 shortcode.

 Examples:

 {{{
 [gallery link="file" columns="4" orderby="rand" numberimages="4" id="256"]
 [gallery link="file" columns="4" orderby="rand" numberimages="4"
 include="263,264,261,260,259"]
 }}}

 In both cases, only 4 images (at most) will be displayed.

 The code on line 836-839 is only necessary because in get_posts(), when
 specifying include="", the numberposts parameter is ignored (it's set to
 match the number if items in include="").

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/12799#comment:3>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list