WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 18 months ago

#29291 closed enhancement (wontfix)

Allow a range of ID's for WP_Query : (prev: Media IDs in gallery shortcode - allow ranges of ids)

Reported by: grosbouff Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.9.2
Component: Query Keywords: has-patch dev-feedback needs-testing
Focuses: Cc:

Description

Hi,
I have a lot of galleries with a lot of images in it.
Usually, media IDs are in order, So I have something like this for shortcode :

[gallery ids="266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,306,307,308,309,310"]

It would be nice being able to use id ranges, like :

[gallery ids="266-298,306-310"]

(like printer drivers do !)

Attachments (1)

29291.patch (1.1 KB) - added by keraweb 3 years ago.
Allow id ranges for post queries (defined with a hyphen: x-xx)

Download all attachments as: .zip

Change History (5)

#1 @chriscct7
3 years ago

  • Keywords needs-patch added

Personally not a fan of this, but it probably wouldn't be hard to support.

#2 @keraweb
3 years ago

Why not extend this to the WP_Query. The gallery shortcode uses the post__in and include parameters.

It's not that difficult to allow a range for this parameter, the parser can convert it to an array of ID's before building the query itself.

Last edited 3 years ago by keraweb (previous) (diff)

@keraweb
3 years ago

Allow id ranges for post queries (defined with a hyphen: x-xx)

#3 @keraweb
3 years ago

  • Component changed from Gallery to Query
  • Keywords has-patch dev-feedback needs-testing added; needs-patch removed
  • Summary changed from Media IDs in gallery shortcode : allow ranges of ids to Allow a range of ID's for WP_Query : (prev: Media IDs in gallery shortcode - allow ranges of ids)

#4 @wonderboymusic
18 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

I understand that the ergonomics of typing these IDs is bad, but they should not be typed: they should be generated by the media modal. The problem with a range is that it requires filtering the results, because none of the properties for IDs requested is known ahead of time.

Note: See TracTickets for help on using tickets.