Make WordPress Core

Changeset 52030


Ignore:
Timestamp:
11/07/2021 10:08:55 PM (3 months ago)
Author:
joedolson
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/admin-header.php

    r51969 r52030  
    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
     
    5772    /* translators: %s: Admin screen title. */
    5873    $admin_title = sprintf( __( 'Recovery Mode — %s' ), $admin_title );
    59 }
    60 
    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     }
    6874}
    6975
Note: See TracChangeset for help on using the changeset viewer.