Editor: Update structure of title element for editing.

Re-format the title element for post editing to follow general scheme for WordPress admin screens.

Props SergeyBiryukov.
Fixes #52314.
Built from https://develop.svn.wordpress.org/trunk@52030


git-svn-id: http://core.svn.wordpress.org/trunk@51622 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
joedolson 2021-11-07 22:09:56 +00:00
parent 56b07f0ea2
commit 201f4ddfbe
2 changed files with 17 additions and 11 deletions

View File

@ -49,8 +49,23 @@ if ( $admin_title === $title ) {
/* translators: Admin screen title. %s: Admin screen name. */
$admin_title = sprintf( __( '%s — WordPress' ), $title );
} else {
$screen_title = $title;
if ( 'post' === $current_screen->base && 'add' !== $current_screen->action ) {
$post_title = get_the_title();
if ( ! empty( $post_title ) ) {
$post_type_obj = get_post_type_object( $typenow );
$screen_title = sprintf(
/* translators: Editor admin screen title. 1: "Edit item" text for the post type, 2: Post title. */
__( '%1$s “%2$s”' ),
$post_type_obj->labels->edit_item,
$post_title
);
}
}
/* translators: Admin screen title. 1: Admin screen name, 2: Network or site name. */
$admin_title = sprintf( __( '%1$s ‹ %2$s — WordPress' ), $title, $admin_title );
$admin_title = sprintf( __( '%1$s ‹ %2$s — WordPress' ), $screen_title, $admin_title );
}
if ( wp_is_recovery_mode() ) {
@ -58,15 +73,6 @@ if ( wp_is_recovery_mode() ) {
$admin_title = sprintf( __( 'Recovery Mode — %s' ), $admin_title );
}
if ( 'post' === $current_screen->base && 'add' !== $current_screen->action ) {
$post_title = get_the_title();
if ( ! empty( $post_title ) ) {
$obj = get_post_type_object( $typenow );
/* translators: Editor admin screen title. 1: "Edit item" text for the post type, 2: Post title. */
$admin_title = sprintf( __( '%1$s “%2$s”' ), $obj->labels->edit_item, $post_title );
}
}
/**
* Filters the title tag content for an admin page.
*

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.9-alpha-52029';
$wp_version = '5.9-alpha-52030';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.