WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years 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 7 years ago.
21816.patch (1.9 KB) - added by SergeyBiryukov 7 years ago.

Download all attachments as: .zip

Change History (7)

#1 @helenyhou
7 years ago

Maybe related: #13729?

@markjaquith
7 years ago

#2 @markjaquith
7 years ago

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

#3 @SergeyBiryukov
7 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
7 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
7 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.