Media: Add wp_enqueue_media to easily include all media dependencies.
Also, media templates now print on `wp_footer`. props sushkov. fixes #22060, see #21390. git-svn-id: http://core.svn.wordpress.org/trunk@22489 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
57db888420
commit
0a67c025e5
|
@ -17,11 +17,6 @@ if ( wp_is_mobile() )
|
|||
|
||||
if ( post_type_supports($post_type, 'editor') || post_type_supports($post_type, 'thumbnail') ) {
|
||||
add_thickbox();
|
||||
|
||||
wp_enqueue_script( 'media-upload' );
|
||||
wp_enqueue_style( 'media-views' );
|
||||
wp_plupload_default_settings();
|
||||
add_action( 'admin_footer', 'wp_print_media_templates' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -383,10 +383,7 @@ document.body.className = document.body.className.replace('no-js', 'js');
|
|||
* @param string $editor_id
|
||||
*/
|
||||
function media_buttons($editor_id = 'content') {
|
||||
wp_enqueue_script( 'media-upload' );
|
||||
wp_enqueue_style( 'media-views' );
|
||||
wp_plupload_default_settings();
|
||||
add_action( 'admin_footer', 'wp_print_media_templates' );
|
||||
wp_enqueue_media();
|
||||
|
||||
$context = apply_filters('media_buttons_context', __('Upload/Insert %s'));
|
||||
|
||||
|
|
|
@ -1290,6 +1290,20 @@ function wp_prepare_attachment_for_js( $attachment ) {
|
|||
return apply_filters( 'wp_prepare_attachment_for_js', $response, $attachment, $meta );
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueues all scripts, styles, settings, and templates necessary to use
|
||||
* all media JS APIs.
|
||||
*
|
||||
* @since 3.5.0
|
||||
*/
|
||||
function wp_enqueue_media() {
|
||||
wp_enqueue_script( 'media-upload' );
|
||||
wp_enqueue_style( 'media-views' );
|
||||
wp_plupload_default_settings();
|
||||
add_action( 'admin_footer', 'wp_print_media_templates' );
|
||||
add_action( 'wp_footer', 'wp_print_media_templates' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints the templates used in the media manager.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue