WordPress.org

Make WordPress Core

Ticket #14832: posttype_menu_label.diff

File posttype_menu_label.diff, 2.3 KB (added by husobj, 4 years ago)
  • wp-includes/post.php

     
    945945function get_post_type_labels( $post_type_object ) { 
    946946        $nohier_vs_hier_defaults = array( 
    947947                'name' => array( _x('Posts', 'post type general name'), _x('Pages', 'post type general name') ), 
     948                'menu_name' => array( _x('Posts', 'post type menu name'), _x('Pages', 'post type menu name') ), 
    948949                'singular_name' => array( _x('Post', 'post type singular name'), _x('Page', 'post type singular name') ), 
    949950                'add_new' => array( _x('Add New', 'post'), _x('Add New', 'page') ), 
    950951                'add_new_item' => array( __('Add New Post'), __('Add New Page') ), 
     
    968969 
    969970        if ( isset( $object->label ) && empty( $object->labels['name'] ) ) 
    970971                $object->labels['name'] = $object->label; 
     972         
     973        if ( isset( $object->labels ) && empty( $object->labels['menu_name'] ) ) 
     974                $object->labels['menu_name'] = $object->labels['name']; 
     975        elseif ( isset( $object->label ) && empty( $object->labels['menu_name'] ) ) 
     976                $object->labels['menu_name'] = $object->labels['name']; 
    971977 
    972978        if ( !isset( $object->labels['singular_name'] ) && isset( $object->labels['name'] ) ) 
    973979                $object->labels['singular_name'] = $object->labels['name']; 
  • wp-admin/menu.php

     
    122122        while ( isset($menu[$ptype_menu_position]) || in_array($ptype_menu_position, $core_menu_positions) ) 
    123123                $ptype_menu_position++; 
    124124 
    125         $menu[$ptype_menu_position] = array( esc_attr( $ptype_obj->labels->name ), $ptype_obj->cap->edit_posts, "edit.php?post_type=$ptype", '', 'menu-top menu-icon-' . $ptype_class, 'menu-posts-' . $ptype_for_id, $menu_icon ); 
     125        $menu[$ptype_menu_position] = array( esc_attr( $ptype_obj->labels->menu_name ), $ptype_obj->cap->edit_posts, "edit.php?post_type=$ptype", '', 'menu-top menu-icon-' . $ptype_class, 'menu-posts-' . $ptype_for_id, $menu_icon ); 
    126126        $submenu["edit.php?post_type=$ptype"][5]  = array( $ptype_obj->labels->name, $ptype_obj->cap->edit_posts,  "edit.php?post_type=$ptype"); 
    127127        $submenu["edit.php?post_type=$ptype"][10]  = array( $ptype_obj->labels->add_new, $ptype_obj->cap->edit_posts, "post-new.php?post_type=$ptype" ); 
    128128