#41853 closed feature request (worksforme)
Filter to handle/override the list of IDs in the Gallery Shortcode
Reported by: | TigrouMeow | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.8.1 |
Component: | Gallery | Keywords: | |
Focuses: | ui | Cc: |
Description
It would be nice to handle the IDs of the media which are used in the Gallery Shortcode from other plugins, depending on the attributes of the shortcode for instance.
A simple filter like:
$attr['ids'] = apply_filters( 'gallery_images', !empty( $attr['ids'] ) ? $attr['ids'] : null, $attr );
Would be perfect! And it could be right before:
if ( ! empty( $attr['ids'] ) ) {
// 'ids' is explicitly ordered, unless you specify otherwise.
if ( empty( $attr['orderby'] ) ) {
$attr['orderby'] = 'post__in';
}
$attr['include'] = $attr['ids'];
}
It is a simple change that wouldn't break anything. And it would allow plugins/themes to handle images in Gallery without having to create complicated Gallery systems. What about it?
Thanks :)
Change History (3)
Note: See
TracTickets for help on using
tickets.
Thanks for your suggestion, but what about the
shortcode_atts_gallery
filter available since version 3.6?Example:
where