How can add a new menu item underneath the “insert From URL” on the left sidebar in the new WordPress 3.5 Media Manager?
I’ve been looking at the backbone js and tried my hand at hooking into it with my own JS but without success.
Edit 2:
This seems to do the trick:
http://sumtips.com/2012/12/add-remove-tab-wordpress-3-5-media-upload-page.html
It should do for simple stuff, but I guess its also possible to do the same thing in Javascript. Would be nice if there was a tutorial/explanation on how the new media manager internals work.
OK, I think that I have something that is really close to be an answer:
I put my code in a gist
Here is the result :
I built several Backbone object to respect the MVC pattern : the
controller.Custom
is in charge of doing all the logic, theview.Toolbar.Custom
deals with toolbar buttons, and theview.Custom
display the inner UI.I’m working on adding a button to the “router menu” (adding something right of “Media Library”), but the system is the same.
Now, it doesn’t do anything yet. That’s the next step!
You can hook into the
media_upload_tabs
filter to add the tab. This is the method used by the Network Shared Media plugin:You can then hook to the
media_upload_tab_slug
action (wheretab_slug
is as used above) to display the tab contents:I have not a solution, but hints. The strings get from a array. You can filter via hook
media_view_strings
. The modal box after click is a javascript, build with backbone.js since WP 3.5. See in/wp-includes/js/media-views.js
for a solution. Backbone is also new for me and the scripts have many lines of source.