Make sure we're on the media grid page before calling wp.media().
props azaozz. fixes #29520 for trunk. git-svn-id: https://develop.svn.wordpress.org/trunk@29725 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
00bfc5bc34
commit
9c48d0f495
@ -72,11 +72,15 @@ var findPosts;
|
|||||||
};
|
};
|
||||||
|
|
||||||
$( document ).ready( function() {
|
$( document ).ready( function() {
|
||||||
|
var $mediaGridWrap = $( '#wp-media-grid' );
|
||||||
|
|
||||||
// Open up a manage media frame into the grid.
|
// Open up a manage media frame into the grid.
|
||||||
wp.media && wp.media({
|
if ( $mediaGridWrap.length && window.wp && window.wp.media ) {
|
||||||
frame: 'manage',
|
window.wp.media({
|
||||||
container: $('#wpbody-content > .wrap')
|
frame: 'manage',
|
||||||
}).open();
|
container: $mediaGridWrap
|
||||||
|
}).open();
|
||||||
|
}
|
||||||
|
|
||||||
$( '#find-posts-submit' ).click( function( event ) {
|
$( '#find-posts-submit' ).click( function( event ) {
|
||||||
if ( ! $( '#find-posts-response input[type="radio"]:checked' ).length )
|
if ( ! $( '#find-posts-response input[type="radio"]:checked' ).length )
|
||||||
|
@ -57,7 +57,7 @@ if ( 'grid' === $mode ) {
|
|||||||
|
|
||||||
require_once( ABSPATH . 'wp-admin/admin-header.php' );
|
require_once( ABSPATH . 'wp-admin/admin-header.php' );
|
||||||
?>
|
?>
|
||||||
<div class="wrap">
|
<div class="wrap" id="wp-media-grid">
|
||||||
<h2>
|
<h2>
|
||||||
<?php
|
<?php
|
||||||
echo esc_html( $title );
|
echo esc_html( $title );
|
||||||
|
Loading…
Reference in New Issue
Block a user