WordPress.org

Make WordPress Core

Opened 20 months ago

Closed 20 months ago

Last modified 17 months ago

#21816 closed task (blessed) (fixed)

Add explicit ordering to the gallery shortcode

Reported by: koopersmith Owned by: 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 20 months ago.
21816.patch (1.9 KB) - added by SergeyBiryukov 20 months ago.

Download all attachments as: .zip

Change History (7)

comment:1 helenyhou20 months ago

Maybe related: #13729?

markjaquith20 months ago

comment:2 markjaquith20 months ago

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

SergeyBiryukov20 months ago

comment:3 SergeyBiryukov20 months 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

comment:4 markjaquith20 months 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

comment:5 nacin17 months 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.