Opened 9 months ago

Closed 9 months ago

Last modified 6 months ago

#21816 closed task (blessed) (fixed)

Add explicit ordering to the gallery shortcode

Reported by: koopersmith Owned by: markjaquith
Priority: normal Milestone: 3.5
Component: Media Version: 3.5
Severity: normal Keywords:
Cc:

Description

One of the media improvements we've discussed for 3.5 is using IDs in the gallery shortcode to specify the included attachments. We can do this currently with the include shortcode, but attachments are not sorted in the order specified, but by another metric (be it menu_order or otherwise). Since the gallery is specific to a given post, arranging attachments in the order the IDs were provided is a sensible improvement.

Attachments (2)

21816.diff (893 bytes) - added by markjaquith 9 months ago.
21816.patch (1.9 KB) - added by SergeyBiryukov 9 months ago.

Download all attachments as: .zip

Change History (7)

Maybe related: #13729?

Completely untested, and requires #13729 to be solved, which I'd really, really like.

21816.patch is an attempt at sorting in PHP (with a bit of cleanup).

posts_per_page wouldn't be an issue here, since get_posts() adjusts it accordingly:
http://core.trac.wordpress.org/browser/tags/3.4.1/wp-includes/post.php#L1450

  • Owner set to markjaquith
  • Resolution set to fixed
  • Status changed from new to closed

In [21778]:

use 'ids' parameter for explicit attachment ordering in [gallery] shortcodes. fixes #21816

In 22891:

In the gallery shortcode, handle mapping of "ids" to include and orderby before the post_gallery filter. see #21816. fixes #22617.

Note: See TracTickets for help on using tickets.