Make WordPress Core

Opened 11 years ago

Closed 15 months ago

#22773 closed enhancement (invalid)

"Gallery Settings" should be extensible

Reported by: jakemgold's profile jakemgold Owned by:
Milestone: Priority: normal
Severity: minor Version: 3.5
Component: Gallery Keywords: needs-patch
Focuses: Cc:


This isn't necessarily new to 3.5, but now that we have a great gallery management system, I think we need to allow developers to customize the Gallery Settings fields (other than Link To / Columns / Random).

My specific use - which I think is common - is a completely custom gallery shortcode for a client. First and foremost, the client would like to be able to "title" the gallery itself, so a hook allowing the addition of custom field(s) would be needed. Ideally, the default fields would also be filterable so they can be removed as well (though I suppose we can do that with CSS now): for instance, most custom gallery implementations don't use the "columns" option.

Change History (7)

#1 @fernandopasik
11 years ago

I would like this too, but it doesn't seem to hard to do.

At least to add a field to the gallery shortcut output we just need an action hook in line 375 of media-template.php.
With just that, adding a new input there it will be on the resulting shortcode.

For example if we add through the action hook html code like this:

<label class="setting">

<span><?php _e( 'custom_field' ); ?></span>
<input type="checkbox" data-setting="custom_field" />


in the shortcut code there will be a custom_field=true, because the media-editor.js already deals with other arguments we add there.

Version 1, edited 11 years ago by fernandopasik (previous) (next) (diff)

#2 @greenshady
11 years ago

  • Cc justin@… added

#3 @iseulde
9 years ago

#28693 was marked as a duplicate.

#4 @wonderboymusic
9 years ago

The only missing piece here (post-4.0) is the extra fields in the Underscore templates - because you can now override the default settings for Gallery in JS via wp_localize_script and PHP via shortcode_atts_gallery

#5 @GregLone
9 years ago

Related: #29032.

#6 @chriscct7
8 years ago

  • Keywords needs-patch added

#7 @desrosj
15 months ago

  • Resolution set to invalid
  • Status changed from new to closed

With the introduction of the block editor and full site editing, I'm going to close this out as a wontfix. A lot of what is described is possible (and arguably easier) with block templates and block template parts. While shortcodes are still supported, using blocks is encouraged in most scenarios instead.

Note: See TracTickets for help on using tickets.