[wp-hackers] Adding the "Insert From URL" tab to a 3.5 upload modal

Luke Bryan lukebryan at sharefaith.com
Sat Mar 30 16:29:08 UTC 2013


For debugging Wordpress' javascript, it's very helpful to have the
minifying turned off:
https://codex.wordpress.org/Debugging_in_WordPress#SCRIPT_DEBUG

Now enter 'wp.media' in Firebug, it will give you a link to the function
definition. As you can see in the source, there are two completely
different classes that are called up depending on the frame attribute:

if ( 'select' === attributes.frame && MediaFrame.Select )
frame = new MediaFrame.Select( attributes );
else if ( 'post' === attributes.frame && MediaFrame.Post )
frame = new MediaFrame.Post( attributes );

Which is why wp.media({frame:'select'}).open() (simple, featured image
picker) is completely different than wp.media({frame:'post'}).open() full
picker.

To expand upon this question - I'm also wondering why these are separate
classes for basically the same file picking functionality. The frame:post
option gives a picker similar to the old one, which shows the insert-url
tab, and can be hooked by NextGen gallery and others, but the simple
featured-image-picker doesn't seem to have any way to hook plugin
functionality into it (or add insert-url tab).

http://wordpress.stackexchange.com/questions/76980/add-a-menu-item-to-wordpress-3-5-media-manager
This answer here looks like the new right-way to extend the new WP3.5
uploader, without the old style iframes. Unfortunately, it doesn't show in
the simple (featured-image) picker. A similar problem exists in NextGen
now, since you can't select a NextGen image from the featured-image.

Is there a recommended way to add a nextgen-style picker, or an additional
option to the 'media' category, for both the post-uploader and the
featured-image style uploader? Will these two pickers be unified in 3.6 or
3.7?

Best regards,
Luke


More information about the wp-hackers mailing list