Media: For pages, use 'Insert into page' rather than 'Insert into post'.

Custom post types can use the media_view_strings filter. No new post type "labels" for now.

see #22712. see #21092 (and #19696).



git-svn-id: http://core.svn.wordpress.org/trunk@22735 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2012-11-20 23:22:03 +00:00
parent 6764610cbb
commit 418c9985f7
2 changed files with 9 additions and 7 deletions

View File

@ -15,11 +15,6 @@ wp_enqueue_script('post');
if ( wp_is_mobile() ) if ( wp_is_mobile() )
wp_enqueue_script( 'jquery-touch-punch' ); wp_enqueue_script( 'jquery-touch-punch' );
if ( post_type_supports($post_type, 'editor') || post_type_supports($post_type, 'thumbnail') ) {
add_thickbox();
wp_enqueue_media();
}
/** /**
* Post ID global * Post ID global
* @name $post_ID * @name $post_ID
@ -29,6 +24,11 @@ $post_ID = isset($post_ID) ? (int) $post_ID : 0;
$user_ID = isset($user_ID) ? (int) $user_ID : 0; $user_ID = isset($user_ID) ? (int) $user_ID : 0;
$action = isset($action) ? $action : ''; $action = isset($action) ? $action : '';
if ( post_type_supports($post_type, 'editor') || post_type_supports($post_type, 'thumbnail') ) {
add_thickbox();
wp_enqueue_media( array( 'post' => $post_id ) );
}
$messages = array(); $messages = array();
$messages['post'] = array( $messages['post'] = array(
0 => '', // Unused. Messages start at index 1. 0 => '', // Unused. Messages start at index 1.

View File

@ -1334,6 +1334,8 @@ function wp_enqueue_media( $args = array() ) {
$settings['postId'] = $post->ID; $settings['postId'] = $post->ID;
} }
$hier = $post && is_post_type_hierarchical( $post->post_type );
$strings = array( $strings = array(
// Generic // Generic
'url' => __( 'URL' ), 'url' => __( 'URL' ),
@ -1354,11 +1356,11 @@ function wp_enqueue_media( $args = array() ) {
// Library // Library
'mediaLibraryTitle' => __( 'Media Library' ), 'mediaLibraryTitle' => __( 'Media Library' ),
'createNewGallery' => __( 'Create a new gallery' ), 'createNewGallery' => __( 'Create a new gallery' ),
'insertIntoPost' => __( 'Insert into post' ), 'insertIntoPost' => $hier ? __( 'Insert into page' ) : __( 'Insert into post' ),
'returnToLibrary' => __( '← Return to library' ), 'returnToLibrary' => __( '← Return to library' ),
'allMediaItems' => __( 'All media items' ), 'allMediaItems' => __( 'All media items' ),
'uploadedToThisPost' => __( 'Uploaded to this post' ), 'uploadedToThisPost' => $hier ? __( 'Uploaded to this page' ) : __( 'Uploaded to this post' ),
'images' => __( 'Images' ), 'images' => __( 'Images' ),
'audio' => __( 'Audio' ), 'audio' => __( 'Audio' ),
'videos' => __( 'Videos' ), 'videos' => __( 'Videos' ),