Make WordPress Core

Ticket #52314: 52314.6.diff

File 52314.6.diff, 1.7 KB (added by SergeyBiryukov, 3 years ago)
  • src/wp-admin/admin-header.php

     
    4949        /* translators: Admin screen title. %s: Admin screen name. */
    5050        $admin_title = sprintf( __( '%s — WordPress' ), $title );
    5151} else {
     52        $screen_title = $title;
     53
     54        if ( 'post' === $current_screen->base && 'add' !== $current_screen->action ) {
     55                $post_title = get_the_title();
     56                if ( ! empty( $post_title ) ) {
     57                        $post_type_obj = get_post_type_object( $typenow );
     58                        $screen_title  = sprintf(
     59                                /* translators: Editor admin screen title. 1: "Edit item" text for the post type, 2: Post title. */
     60                                __( '%1$s “%2$s”' ),
     61                                $post_type_obj->labels->edit_item,
     62                                $post_title
     63                        );
     64                }
     65        }
     66
    5267        /* translators: Admin screen title. 1: Admin screen name, 2: Network or site name. */
    53         $admin_title = sprintf( __( '%1$s ‹ %2$s — WordPress' ), $title, $admin_title );
     68        $admin_title = sprintf( __( '%1$s ‹ %2$s — WordPress' ), $screen_title, $admin_title );
    5469}
    5570
    5671if ( wp_is_recovery_mode() ) {
     
    5873        $admin_title = sprintf( __( 'Recovery Mode — %s' ), $admin_title );
    5974}
    6075
    61 if ( 'post' === $current_screen->base && 'add' !== $current_screen->action ) {
    62         $post_title = get_the_title();
    63         if ( ! empty( $post_title ) ) {
    64                 $obj = get_post_type_object( $typenow );
    65                 /* translators: Editor admin screen title. 1: "Edit item" text for the post type, 2: Post title. */
    66                 $admin_title = sprintf( __( '%1$s “%2$s”' ), $obj->labels->edit_item, $post_title );
    67         }
    68 }
    69 
    7076/**
    7177 * Filters the title tag content for an admin page.
    7278 *