Make WordPress Core

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#21816 closed task (blessed) (fixed)

Add explicit ordering to the gallery shortcode

Reported by: koopersmith's profile koopersmith Owned by: markjaquith's profile markjaquith
Milestone: 3.5 Priority: normal
Severity: normal Version: 3.5
Component: Media Keywords:
Focuses: 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 12 years ago.
21816.patch (1.9 KB) - added by SergeyBiryukov 12 years ago.

Download all attachments as: .zip

Change History (7)

#1 @helenyhou
12 years ago

Maybe related: #13729?

@markjaquith
12 years ago

#2 @markjaquith
12 years ago

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

#3 @SergeyBiryukov
12 years ago

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

#4 @markjaquith
12 years ago

  • 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

#5 @nacin
12 years ago

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.