WordPress 3.5 Media Manager: is there a “good” way to add an extra selection on the Create Gallery tab?

Ok, I mean using hooks / filters.

Basically, the default is two options: Images and Uploaded to this page . I would like to add an additional option there. I know how to add a new tab to the media manager ( see here ), but this does not achieve what I need.

I looked through the limited documentation for 3.5 and found the filters media_view_strings/settings , but, based on what I can say, in this case they cannot be used. I also rummaged quite a bit in the main source, but the number of files related to the media loader is at least the most complex.

I thought about starting JS after loading the page to change the DOM and just add an extra selection option, but this seems very hacky, and I would like to avoid it if there is a better and more reliable solution.

Any thoughts on the best way to approach this will be greatly appreciated!

Note. I did not publish this on the WordPress SE website, as it receives much less traffic, and the issues are generally much less related to programming.

+4
source share
2 answers

Most of these drop-down menus relate to wp-includes / media-template.php, in which there are many Underscore templates ( <script type="text/html" tags), but a few hooks for PHP code. With Javascript, you can bind Backbone.js hooks to wp.media events, such as wp.media open / close events. From such an event, you could capture the selected Images / uploaded to-page frames with jQuery('.media-modal-content:visible .attachment-filters') , add elements and listeners as needed. I am sure there should be a much better solution to Backbone.js.

+1
source

Here is a Shiba Shake tutorial on this ...

How to Extend MediaPage WordPress Interface

I hope this is useful to you!

0
source

All Articles