Ticket #16865: 16865.2.diff
| File 16865.2.diff, 6.2 KB (added by scribu, 2 years ago) |
|---|
-
wp-includes/post.php
19 19 function create_initial_post_types() { 20 20 register_post_type( 'post', array( 21 21 'public' => true, 22 ' _builtin' => true, /* internal use only. don't use this when registering your own post type. */22 'menu_position' => 5, 23 23 '_edit_link' => 'post.php?post=%d', /* internal use only. don't use this when registering your own post type. */ 24 24 'capability_type' => 'post', 25 25 'map_meta_cap' => true, -
wp-admin/menu.php
21 21 * @name $menu 22 22 * @var array 23 23 */ 24 function _wp_build_admin_menu() { 25 global $menu, $submenu, $_wp_last_object_menu, $_wp_last_utility_menu, $_wp_real_parent_file; 24 26 25 27 $menu[2] = array( __('Dashboard'), 'read', 'index.php', '', 'menu-top menu-top-first menu-icon-dashboard', 'menu-dashboard', 'div' ); 26 28 … … 58 60 $submenu[ 'index.php' ][10] = array( sprintf( __('Updates %s'), "<span class='update-plugins count-$total_update_count' title='$update_title'><span class='update-count'>" . number_format_i18n($total_update_count) . "</span></span>" ), 'update_core', 'update-core.php'); 59 61 } 60 62 61 unset($plugin_update_count, $theme_update_count, $wordpress_update_count, $update_themes, $update_plugins, $update_wordpress);62 63 63 $menu[4] = array( '', 'read', 'separator1', '', 'wp-menu-separator' ); 64 64 65 $menu[5] = array( __('Posts'), 'edit_posts', 'edit.php', '', 'open-if-no-js menu-top menu-icon-post', 'menu-posts', 'div' );66 $submenu['edit.php'][5] = array( __('Posts'), 'edit_posts', 'edit.php' );67 /* translators: add new post */68 $submenu['edit.php'][10] = array( _x('Add New', 'post'), 'edit_posts', 'post-new.php' );69 70 $i = 15;71 foreach ( get_taxonomies( array(), 'objects' ) as $tax ) {72 if ( ! $tax->show_ui || ! in_array('post', (array) $tax->object_type, true) )73 continue;74 75 $submenu['edit.php'][$i++] = array( esc_attr( $tax->labels->menu_name ), $tax->cap->manage_terms, 'edit-tags.php?taxonomy=' . $tax->name );76 }77 unset($tax);78 79 65 $menu[10] = array( __('Media'), 'upload_files', 'upload.php', '', 'menu-top menu-icon-media', 'menu-media', 'div' ); 80 66 $submenu['upload.php'][5] = array( __('Library'), 'upload_files', 'upload.php'); 81 67 /* translators: add new file */ … … 103 89 $awaiting_mod = wp_count_comments(); 104 90 $awaiting_mod = $awaiting_mod->moderated; 105 91 $menu[25] = array( sprintf( __('Comments %s'), "<span id='awaiting-mod' class='count-$awaiting_mod'><span class='pending-count'>" . number_format_i18n($awaiting_mod) . "</span></span>" ), 'edit_posts', 'edit-comments.php', '', 'menu-top menu-icon-comments', 'menu-comments', 'div' ); 106 unset($awaiting_mod);107 92 108 93 $_wp_last_object_menu = 25; // The index of the last top-level menu in the object menu group 109 94 … … 114 99 continue; 115 100 $ptype_menu_position = is_int( $ptype_obj->menu_position ) ? $ptype_obj->menu_position : ++$_wp_last_object_menu; // If we're to use $_wp_last_object_menu, increment it first. 116 101 $ptype_for_id = sanitize_html_class( $ptype ); 102 117 103 if ( is_string( $ptype_obj->menu_icon ) ) { 118 104 $menu_icon = esc_url( $ptype_obj->menu_icon ); 119 105 $ptype_class = $ptype_for_id; … … 122 108 $ptype_class = 'post'; 123 109 } 124 110 111 $menu_class = 'menu-top menu-icon-' . $ptype_class; 112 // 'post' special case 113 if ( 'post' == $ptype ) 114 $menu_class .= ' open-if-no-js'; 115 125 116 // if $ptype_menu_position is already populated or will be populated by a hard-coded value below, increment the position. 126 117 $core_menu_positions = array(59, 60, 65, 70, 75, 80, 85, 99); 127 118 while ( isset($menu[$ptype_menu_position]) || in_array($ptype_menu_position, $core_menu_positions) ) 128 119 $ptype_menu_position++; 129 120 130 $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 ); 121 $menu[$ptype_menu_position] = array( esc_attr( $ptype_obj->labels->menu_name ), $ptype_obj->cap->edit_posts, "edit.php?post_type=$ptype", '', $menu_class, 'menu-posts-' . $ptype_for_id, $menu_icon ); 122 131 123 $submenu["edit.php?post_type=$ptype"][5] = array( $ptype_obj->labels->menu_name, $ptype_obj->cap->edit_posts, "edit.php?post_type=$ptype"); 132 124 $submenu["edit.php?post_type=$ptype"][10] = array( $ptype_obj->labels->add_new, $ptype_obj->cap->edit_posts, "post-new.php?post_type=$ptype" ); 133 125 … … 139 131 $submenu["edit.php?post_type=$ptype"][$i++] = array( esc_attr( $tax->labels->menu_name ), $tax->cap->manage_terms, "edit-tags.php?taxonomy=$tax->name&post_type=$ptype" ); 140 132 } 141 133 } 142 unset($ptype, $ptype_obj, $ptype_class, $ptype_for_id, $ptype_menu_position, $menu_icon, $i, $tax);143 134 144 135 $menu[59] = array( '', 'read', 'separator2', '', 'wp-menu-separator' ); 145 136 … … 181 172 $submenu['plugins.php'][15] = array( _x('Editor', 'plugin editor'), 'edit_plugins', 'plugin-editor.php' ); 182 173 } 183 174 } 184 unset($menu_perms, $update_plugins, $update_count);185 175 186 176 if ( current_user_can('list_users') ) 187 177 $menu[70] = array( __('Users'), 'list_users', 'users.php', '', 'menu-top menu-icon-users', 'menu-users', 'div' ); … … 235 225 $_wp_real_parent_file['page-new.php'] = 'edit.php?post_type=page'; 236 226 $_wp_real_parent_file['wpmu-admin.php'] = 'tools.php'; 237 227 $_wp_real_parent_file['ms-admin.php'] = 'tools.php'; 228 } 229 _wp_build_admin_menu(); 238 230 239 231 // ensure we're backwards compatible 240 232 $compat = array( -
wp-admin/edit.php
35 35 } 36 36 unset( $_redirect ); 37 37 38 if ( 'post' != $post_type ) { 39 $parent_file = "edit.php?post_type=$post_type"; 40 $submenu_file = "edit.php?post_type=$post_type"; 41 $post_new_file = "post-new.php?post_type=$post_type"; 42 } else { 43 $parent_file = 'edit.php'; 44 $submenu_file = 'edit.php'; 45 $post_new_file = 'post-new.php'; 46 } 38 $parent_file = "edit.php?post_type=$post_type"; 39 $submenu_file = "edit.php?post_type=$post_type"; 40 $post_new_file = "post-new.php?post_type=$post_type"; 47 41 48 42 $doaction = $wp_list_table->current_action(); 49 43
