Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#22637 closed defect (bug) (fixed)

Gallery sort options

Reported by: nacin Owned by: ryan
Milestone: 3.5 Priority: normal
Severity: normal Version: 3.5
Component: Gallery Keywords: has-patch needs-testing i18n-change
Focuses: Cc:


A lot of user feedback from the WP.com support forums has been the missing gallery sort options. There were a bunch of them in core, in a number of forms:

— Sort the queue ascending and descending (these seemed to invert the queue)

— Order by: Menu order, title, Date/time, and Random

— Order: ascending and descending sort for the "Order by" properties

It looks like we need some of this back. These should all be "on-the-fly" sorting, as in, they sort the images in the view, then save it to the "ids" attribute of the gallery shortcode.

We should support a way to immediately sort the entire gallery by title, date/time, random, and then the ability to inverse the gallery.

Attachments (2)

22637.diff (4.5 KB) - added by koopersmith 9 years ago.
22637.2.diff (8.4 KB) - added by koopersmith 9 years ago.

Download all attachments as: .zip

Change History (16)

#1 @azaozz
9 years ago

Not sure what would be the better UI here: have two selects, one for the sort option another for ASC/DESC, or combine them in one. In the second case it would need to be:

  • Date/time (ascending) default
  • Date/time (descending)
  • Upload order (ascending)
  • Upload order (descending)
  • Title (ascending)
  • Title (descending)
  • Random

The other thing is Date/time should use the EXIF date for JPEGs and is the same as Upload order for other images or non-images. Menu order is irrelevant as we pass the attachment IDs directly.

#2 @ryan
9 years ago

The most requested is random. If handling them all is too much for RC I think we could get by with having only manual and random sort.

#3 follow-up: @paulwp
9 years ago

I've just now finished posting a new gallery on one of my site in wp.com here below is from my memory.


You upload bunch of images to the post then switch to gallery tab (which will show only images uploaded to that post), then if care - click drag to sort order, then click save all change, then in the post editor you only have [gallery] and then that's it.


The default window will show all media by default, you have to select dropdown to show only images for that post ( one extra step ), then before performing the sort order, you need to click to select the image one by one (selecting by shift-click won't work), click edit to switch to the sort order state then click drag to sort order.

from there you have to make a choice between "Insert into post" and "Make a new gallery"

and if you choose "Insert into post" hoping to insert the gallery you've just made into the post, it will insert all the images into post not the gallery.

You have to click "Make a new gallery", then in the post editor you will get

[gallery ids="1998,1904,1903,2004,1902,1901,1900,2011,1993,1995,2005,1994,1992,...,]

Shortcode is not for short anymore

The default "sort order by menu order" is missing, so to have gallery sorted you have to have that much code in the so called shortcode.

Version 0, edited 9 years ago by paulwp (next)

#4 @ryan
9 years ago

Drag a bunch images onto the media modal in one go, "Create a new Gallery", drag to sort, "Insert Gallery", done.

Who cares if the shortcode is longer? That 'ids' arg allows us to have multiple galleries per post, each of which can be sorted independently. That was impossible before.

#5 in reply to: ↑ 3 @ocean90
9 years ago

Replying to paulwp:

Shortcode is not for short anymore

It's still short. Take a look at the frontend output and then compare it again. ;)

9 years ago

#6 @koopersmith
9 years ago

  • Keywords has-patch needs-testing added

Patch adds support for instantly reversing the gallery order and a checkbox to maintain a random sort order. The gallery shortcode's ids attribute will now respect the orderby attribute if it is explictly set, and will only set orderby to post__in if the attribute is empty.

#7 @nacin
9 years ago

Something is funny with the reverse command:

The second and third screenshots then alternate with each click. Probably something obvious.

9 years ago

#8 @koopersmith
9 years ago

Latest patch fixes the aforementioned bug and removes the Selection model's overloaded remove/reset methods, as the natives are more effective and standardized.

#9 @ryan
9 years ago

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

In 22987:

Add random and reverse sorting options to gallery settings.

Props koopersmith
fixes #22637

#10 @nacin
9 years ago

  • Keywords i18n-change added

This added the "Reverse order" string.

#11 @th23
9 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

...not sure, if I am allowed to re-open reports, but I wouldn't consider this "fixed".

While this brings back some of the functionality from the previous version, it still does not provide any sorting options according to attachment title etc. I would consider this highly beneficial in addition to having to sort everything manual!?

Additionally, to make this effective it would be nice to see the title, date/ time of each attachment in the overview - or at least to be able to switch between list view (previous style) and preview style (as in 3.5)

#12 @th23
9 years ago

  • Cc trac-th23@… added

#13 @markoheijnen
9 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

You are not allowed to re-open a ticket when it is marked as fixed on a finished milestone. I do have to say that the point given is valid if I would read the ticket description. Not sure what is best to do. I guess it is best to create a new ticket.

Note: See TracTickets for help on using tickets.