Introduce featured_image, set_featured_image, remove_featured_image, and use_featured_image post type labels when registering a post type in order to override the 'Featured Image' text and its related phrases.
Props johnbillion, mordauk, valendesigns. Fixes #19257. Built from https://develop.svn.wordpress.org/trunk@32673 git-svn-id: http://core.svn.wordpress.org/trunk@32643 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -2313,6 +2313,7 @@ function wp_maybe_load_embeds() {
|
||||
}
|
||||
|
||||
wp_embed_register_handler( 'youtube_embed_url', '#https?://(www.)?youtube\.com/embed/([^/]+)#i', 'wp_embed_handler_youtube' );
|
||||
wp_embed_register_handler( 'youtube_v_url', '#https?://(www.)?youtube\.com/v/([^/]+)#i', 'wp_embed_handler_youtube' );
|
||||
|
||||
wp_embed_register_handler( 'googlevideo', '#http://video\.google\.([A-Za-z.]{2,5})/videoplay\?docid=([\d-]+)(.*?)#i', 'wp_embed_handler_googlevideo' );
|
||||
|
||||
@@ -3008,6 +3009,8 @@ function wp_enqueue_media( $args = array() ) {
|
||||
|
||||
$hier = $post && is_post_type_hierarchical( $post->post_type );
|
||||
|
||||
$post_type_object = get_post_type_object( $post->post_type );
|
||||
|
||||
$strings = array(
|
||||
// Generic
|
||||
'url' => __( 'URL' ),
|
||||
@@ -3066,8 +3069,8 @@ function wp_enqueue_media( $args = array() ) {
|
||||
'insertFromUrlTitle' => __( 'Insert from URL' ),
|
||||
|
||||
// Featured Images
|
||||
'setFeaturedImageTitle' => __( 'Set Featured Image' ),
|
||||
'setFeaturedImage' => __( 'Set featured image' ),
|
||||
'setFeaturedImageTitle' => $post_type_object->labels->featured_image,
|
||||
'setFeaturedImage' => $post_type_object->labels->set_featured_image,
|
||||
|
||||
// Gallery
|
||||
'createGalleryTitle' => __( 'Create Gallery' ),
|
||||
|
||||
@@ -1624,12 +1624,17 @@ function _post_type_meta_capabilities( $capabilities = null ) {
|
||||
* - parent_item_colon - This string isn't used on non-hierarchical types. In hierarchical
|
||||
* ones the default is 'Parent Page:'.
|
||||
* - all_items - String for the submenu. Default is All Posts/All Pages.
|
||||
* - featured_image - Default is Featured Image.
|
||||
* - set_featured_image - Default is Set featured image.
|
||||
* - remove_featured_image - Default is Remove featured image.
|
||||
* - use_featured_image - Default is Use as featured image.
|
||||
* - menu_name - Default is the same as `name`.
|
||||
*
|
||||
* Above, the first default value is for non-hierarchical post types (like posts)
|
||||
* and the second one is for hierarchical post types (like pages).
|
||||
*
|
||||
* @since 3.0.0
|
||||
* @since 4.3.0 Added the `featured_image`, `set_featured_image`, `remove_featured_image`, and `use_featured_image` labels.
|
||||
* @access private
|
||||
*
|
||||
* @param object $post_type_object Post type object.
|
||||
@@ -1648,7 +1653,11 @@ function get_post_type_labels( $post_type_object ) {
|
||||
'not_found' => array( __('No posts found.'), __('No pages found.') ),
|
||||
'not_found_in_trash' => array( __('No posts found in Trash.'), __('No pages found in Trash.') ),
|
||||
'parent_item_colon' => array( null, __('Parent Page:') ),
|
||||
'all_items' => array( __( 'All Posts' ), __( 'All Pages' ) )
|
||||
'all_items' => array( __( 'All Posts' ), __( 'All Pages' ) ),
|
||||
'featured_image' => array( __( 'Featured Image' ), __( 'Featured Image' ) ),
|
||||
'set_featured_image' => array( __( 'Set featured image' ), __( 'Set featured image' ) ),
|
||||
'remove_featured_image' => array( __( 'Remove featured image' ), __( 'Remove featured image' ) ),
|
||||
'use_featured_image' => array( __( 'Use as featured image' ), __( 'Use as featured image' ) ),
|
||||
);
|
||||
$nohier_vs_hier_defaults['menu_name'] = $nohier_vs_hier_defaults['name'];
|
||||
|
||||
|
||||
@@ -570,13 +570,20 @@ function wp_default_scripts( &$scripts ) {
|
||||
'error' => __( 'Could not load the preview image. Please reload the page and try again.' )
|
||||
));
|
||||
|
||||
$scripts->add( 'set-post-thumbnail', "/wp-admin/js/set-post-thumbnail$suffix.js", array( 'jquery' ), false, 1 );
|
||||
did_action( 'init' ) && $scripts->localize( 'set-post-thumbnail', 'setPostThumbnailL10n', array(
|
||||
'setThumbnail' => __( 'Use as featured image' ),
|
||||
$setPostThumbnailL10n = array(
|
||||
'setThumbnail' => __( 'Use as featured image' ), // Back compat
|
||||
'saving' => __( 'Saving...' ),
|
||||
'error' => __( 'Could not set that as the thumbnail image. Try a different attachment.' ),
|
||||
'done' => __( 'Done' )
|
||||
) );
|
||||
);
|
||||
|
||||
foreach ( get_post_types( null, 'objects' ) as $post_type_object ) {
|
||||
if ( isset( $post_type_object->labels->use_featured_image ) ) {
|
||||
$setPostThumbnailL10n[ "setThumbnail_{$post_type_object->name}" ] = $post_type_object->labels->use_featured_image;
|
||||
}
|
||||
}
|
||||
$scripts->add( 'set-post-thumbnail', "/wp-admin/js/set-post-thumbnail$suffix.js", array( 'jquery' ), false, 1 );
|
||||
did_action( 'init' ) && $scripts->localize( 'set-post-thumbnail', 'setPostThumbnailL10n', $setPostThumbnailL10n );
|
||||
|
||||
// Navigation Menus
|
||||
$scripts->add( 'nav-menu', "/wp-admin/js/nav-menu$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable', 'wp-lists', 'postbox' ) );
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.3-alpha-32672';
|
||||
$wp_version = '4.3-alpha-32673';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
||||
Reference in New Issue
Block a user