WordPress.org

Make WordPress Core

Ticket #16406: 16406.2.diff

File 16406.2.diff, 2.1 KB (added by nacin, 3 years ago)
  • wp-includes/post.php

     
    1818 */ 
    1919function create_initial_post_types() { 
    2020        register_post_type( 'post', array( 
     21                'labels' => array( 
     22                        'name_admin_bar' => _x( 'Post', 'add new on admin bar' ), 
     23                ), 
    2124                'public'  => true, 
    2225                '_builtin' => true, /* internal use only. don't use this when registering your own post type. */ 
    2326                '_edit_link' => 'post.php?post=%d', /* internal use only. don't use this when registering your own post type. */ 
     
    3033        ) ); 
    3134 
    3235        register_post_type( 'page', array( 
     36                'labels' => array( 
     37                        'name_admin_bar' => _x( 'Page', 'add new on admin bar' ), 
     38                ), 
    3339                'public' => true, 
    3440                'publicly_queryable' => false, 
    3541                '_builtin' => true, /* internal use only. don't use this when registering your own post type. */ 
     
    11941200        if ( !isset( $object->labels['singular_name'] ) && isset( $object->labels['name'] ) ) 
    11951201                $object->labels['singular_name'] = $object->labels['name']; 
    11961202 
     1203        if ( ! isset( $object->labels['name_admin_bar'] ) ) 
     1204                $object->labels['name_admin_bar'] = isset( $object->labels['singular_name'] ) ? $object->labels['singular_name'] : $object->name; 
     1205 
    11971206        if ( !isset( $object->labels['menu_name'] ) && isset( $object->labels['name'] ) ) 
    11981207                $object->labels['menu_name'] = $object->labels['name']; 
    11991208 
  • wp-includes/admin-bar.php

     
    242242                if ( true !== $ptype_obj->show_in_menu || ! current_user_can( $ptype_obj->cap->edit_posts ) ) 
    243243                        continue; 
    244244 
    245                 $actions[ 'post-new.php?post_type=' . $ptype_obj->name ] = array( $ptype_obj->labels->singular_name, $ptype_obj->cap->edit_posts, 'new-' . $ptype_obj->name ); 
     245                $actions[ 'post-new.php?post_type=' . $ptype_obj->name ] = array( $ptype_obj->labels->name_admin_bar, $ptype_obj->cap->edit_posts, 'new-' . $ptype_obj->name ); 
    246246        } 
    247247 
    248248        if ( current_user_can( 'upload_files' ) )