WordPress.org

Make WordPress Core

Opened 7 months ago

Last modified 5 months ago

#22773 new enhancement

"Gallery Settings" should be extensible

Reported by: jakemgold Owned by:
Priority: normal Milestone: Awaiting Review
Component: Gallery Version: 3.5
Severity: minor Keywords:
Cc: justin@…

Description

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 (2)

comment:1 fernandopasik6 months 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" />

</label>

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

Last edited 6 months ago by fernandopasik (previous) (diff)

comment:2 greenshady5 months ago

  • Cc justin@… added
Note: See TracTickets for help on using tickets.