Changeset 33723 for trunk/src/wp-admin/menu.php
- Timestamp:
- 08/24/2015 09:18:20 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/menu.php
r32654 r33723 45 45 $menu[4] = array( '', 'read', 'separator1', '', 'wp-menu-separator' ); 46 46 47 $menu[5] = array( __('Posts'), 'edit_posts', 'edit.php', '', 'open-if-no-js menu-top menu-icon-post', 'menu-posts', 'dashicons-admin-post' ); 48 $submenu['edit.php'][5] = array( __('All Posts'), 'edit_posts', 'edit.php' ); 49 /* translators: add new post */ 50 $submenu['edit.php'][10] = array( _x('Add New', 'post'), get_post_type_object( 'post' )->cap->create_posts, 'post-new.php' ); 51 52 $i = 15; 53 foreach ( get_taxonomies( array(), 'objects' ) as $tax ) { 54 if ( ! $tax->show_ui || ! $tax->show_in_menu || ! in_array('post', (array) $tax->object_type, true) ) 55 continue; 56 57 $submenu['edit.php'][$i++] = array( esc_attr( $tax->labels->menu_name ), $tax->cap->manage_terms, 'edit-tags.php?taxonomy=' . $tax->name ); 58 } 59 unset($tax); 47 // $menu[5] = Posts 60 48 61 49 $menu[10] = array( __('Media'), 'upload_files', 'upload.php', '', 'menu-top menu-icon-media', 'menu-media', 'dashicons-admin-media' ); … … 77 65 $submenu['link-manager.php'][15] = array( __('Link Categories'), 'manage_categories', 'edit-tags.php?taxonomy=link_category' ); 78 66 79 $menu[20] = array( __('Pages'), 'edit_pages', 'edit.php?post_type=page', '', 'menu-top menu-icon-page', 'menu-pages', 'dashicons-admin-page' ); 80 $submenu['edit.php?post_type=page'][5] = array( __('All Pages'), 'edit_pages', 'edit.php?post_type=page' ); 81 /* translators: add new page */ 82 $submenu['edit.php?post_type=page'][10] = array( _x('Add New', 'page'), get_post_type_object( 'page' )->cap->create_posts, 'post-new.php?post_type=page' ); 83 $i = 15; 84 foreach ( get_taxonomies( array(), 'objects' ) as $tax ) { 85 if ( ! $tax->show_ui || ! $tax->show_in_menu || ! in_array('page', (array) $tax->object_type, true) ) 86 continue; 87 88 $submenu['edit.php?post_type=page'][$i++] = array( esc_attr( $tax->labels->menu_name ), $tax->cap->manage_terms, 'edit-tags.php?taxonomy=' . $tax->name . '&post_type=page' ); 89 } 90 unset($tax); 67 // $menu[20] = Pages 91 68 92 69 $awaiting_mod = wp_count_comments(); … … 99 76 $_wp_last_object_menu = 25; // The index of the last top-level menu in the object menu group 100 77 101 foreach ( (array) get_post_types( array('show_ui' => true, '_builtin' => false, 'show_in_menu' => true ) ) as $ptype ) { 78 $types = (array) get_post_types( array('show_ui' => true, '_builtin' => false, 'show_in_menu' => true ) ); 79 $builtin = array( 'post', 'page' ); 80 foreach ( array_merge( $builtin, $types ) as $ptype ) { 102 81 $ptype_obj = get_post_type_object( $ptype ); 103 82 // Check if it should be a submenu. … … 114 93 $menu_icon = esc_url( $ptype_obj->menu_icon ); 115 94 } 116 $ptype_class = $ptype_for_id; 95 } elseif ( in_array( $ptype, $builtin ) ) { 96 $menu_icon = 'dashicons-admin-' . $ptype; 97 } 98 99 $menu_class = 'menu-top menu-icon-' . $ptype_for_id; 100 // 'post' special case 101 if ( 'post' === $ptype ) { 102 $menu_class .= ' open-if-no-js'; 103 $ptype_file = "edit.php"; 104 $post_new_file = "post-new.php"; 105 $edit_tags_file = "edit-tags.php?taxonomy=%s"; 117 106 } else { 118 $menu_icon = 'dashicons-admin-post'; 119 $ptype_class = 'post'; 120 } 121 107 $ptype_file = "edit.php?post_type=$ptype"; 108 $post_new_file = "post-new.php?post_type=$ptype"; 109 $edit_tags_file = "edit-tags.php?taxonomy=%s&post_type=$ptype"; 110 } 111 112 if ( in_array( $ptype, $builtin ) ) { 113 $ptype_menu_id = 'menu-' . $ptype_for_id . 's'; 114 } else { 115 $ptype_menu_id = 'menu-posts-' . $ptype_for_id; 116 } 122 117 /* 123 118 * If $ptype_menu_position is already populated or will be populated … … 128 123 $ptype_menu_position++; 129 124 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 );131 $submenu[ "edit.php?post_type=$ptype"][5] = array( $ptype_obj->labels->all_items, $ptype_obj->cap->edit_posts, "edit.php?post_type=$ptype");132 $submenu[ "edit.php?post_type=$ptype"][10] = array( $ptype_obj->labels->add_new, $ptype_obj->cap->create_posts, "post-new.php?post_type=$ptype");125 $menu[$ptype_menu_position] = array( esc_attr( $ptype_obj->labels->menu_name ), $ptype_obj->cap->edit_posts, $ptype_file, '', $menu_class, $ptype_menu_id, $menu_icon ); 126 $submenu[ $ptype_file ][5] = array( $ptype_obj->labels->all_items, $ptype_obj->cap->edit_posts, $ptype_file ); 127 $submenu[ $ptype_file ][10] = array( $ptype_obj->labels->add_new, $ptype_obj->cap->create_posts, $post_new_file ); 133 128 134 129 $i = 15; … … 137 132 continue; 138 133 139 $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 } 141 } 142 unset($ptype, $ptype_obj, $ptype_ class, $ptype_for_id, $ptype_menu_position, $menu_icon, $i, $tax);134 $submenu[ $ptype_file ][$i++] = array( esc_attr( $tax->labels->menu_name ), $tax->cap->manage_terms, sprintf( $edit_tags_file, $tax->name ) ); 135 } 136 } 137 unset($ptype, $ptype_obj, $ptype_for_id, $ptype_menu_position, $menu_icon, $i, $tax); 143 138 144 139 $menu[59] = array( '', 'read', 'separator2', '', 'wp-menu-separator' );
Note: See TracChangeset
for help on using the changeset viewer.