Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#27058 closed enhancement (duplicate)

Limit parameter for [gallery] shortcode

Reported by: nboehr's profile nboehr Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.8
Component: Gallery Keywords: has-patch
Focuses: Cc:

Description

The gallery shortcode does not allow to limit the number of images displayed.

The attached patch adds this functionality. The default behaviour is not changed, i.e. by default, all images are displayed. The new parameter is called limit. Also, if you explicitly specifiy the IDs via include=, ids= or exclude=, all images are displayed, regardless of whether the parameter is specified or not. If you guys think that this behaviour is not optimal, please add your comments so I can adjust the patch.

Example usage:

[gallery id="57" limit=3]

The patch is against the latest HEAD revision 26993.

Attachments (3)

shortcode-gallery-limit-parameter.patch (1.6 KB) - added by nboehr 9 years ago.
shortcode-gallery-limit-parameter-r28200.patch (1.6 KB) - added by nboehr 9 years ago.
Patch for Revision 28200
media.patch (1.8 KB) - added by nboehr 9 years ago.
Working patch against revision 28669

Download all attachments as: .zip

Change History (9)

#1 @mordauk
9 years ago

Seems like a good addition, +1.

#2 @SergeyBiryukov
9 years ago

  • Component changed from Media to Gallery
  • Summary changed from Patch: Limit parameter for [gallery] shortcode to Limit parameter for [gallery] shortcode
  • Version changed from trunk to 3.8

@nboehr
9 years ago

Patch for Revision 28200

#3 @nboehr
9 years ago

I just added a new version of the patch that applies to revision 28200. If there is anything I can do to get this into the wordpress codebase, please let me know.

#4 @wonderboymusic
9 years ago

  • Keywords has-patch needs-refresh added
  • Milestone changed from Awaiting Review to Future Release

Patch is blowing up.

@nboehr
9 years ago

Working patch against revision 28669

#5 @nboehr
9 years ago

  • Keywords needs-refresh removed

I have updated the patch and uploaded a new version that works against latest subversion.

#6 @wonderboymusic
9 years ago

  • Milestone Future Release deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #11725.

Note: See TracTickets for help on using tickets.