Changeset 15844
- Timestamp:
- 10/19/2010 07:58:02 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/template.php
r15843 r15844 1898 1898 global $current_screen, $typenow; 1899 1899 1900 var_dump( $current_screen ); 1900 1901 if ( empty($screen) ) 1901 1902 $screen = $current_screen; -
trunk/wp-admin/menu-header.php
r14127 r15844 48 48 $class[] = 'wp-has-submenu'; 49 49 50 if ( ( $parent_file && $item[2] == $parent_file ) || ( false === strpos($parent_file, '?') && $self == $item[2] ) ) {50 if ( ( $parent_file && $item[2] == $parent_file ) || ( empty($typenow) && $self == $item[2] ) ) { 51 51 if ( !empty($submenu[$item[2]]) ) 52 52 $class[] = 'wp-has-current-submenu wp-menu-open'; -
trunk/wp-admin/menu.php
r15747 r15844 106 106 $_wp_last_object_menu = 25; // The index of the last top-level menu in the object menu group 107 107 108 foreach ( (array) get_post_types( array('show_ui' => true, '_builtin' => false ) ) as $ptype ) {108 foreach ( (array) get_post_types( array('show_ui' => true, '_builtin' => false, 'show_in_menu' => true ) ) as $ptype ) { 109 109 $ptype_obj = get_post_type_object( $ptype ); 110 // Check if it should be a submenu. 111 if ( $ptype_obj->show_in_menu !== true ) 112 continue; 110 113 $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. 111 114 $ptype_for_id = sanitize_html_class( $ptype ); -
trunk/wp-includes/post.php
r15843 r15844 833 833 * - publicly_queryable - Whether post_type queries can be performed from the front page. Defaults to whatever public is set as. 834 834 * - show_ui - Whether to generate a default UI for managing this post type. Defaults to true if the type is public, false if the type is not public. 835 * - show_in_menu - Where to show the post type in the admin menu. True for a top level menu, false for no menu, or can be a top level page like 'tools.php' or 'edit.php?post_type=page'. show_ui must be true. 835 836 * - menu_position - The position in the menu order the post type should appear. Defaults to the bottom. 836 837 * - menu_icon - The url to the icon to be used for this menu. Defaults to use the posts icon. … … 869 870 'public' => false, 'rewrite' => true, 'query_var' => true, 'supports' => array(), 'register_meta_box_cb' => null, 870 871 'taxonomies' => array(), 'show_ui' => null, 'menu_position' => null, 'menu_icon' => null, 871 'permalink_epmask' => EP_PERMALINK, 'can_export' => true, 'show_in_nav_menus' => null 872 'permalink_epmask' => EP_PERMALINK, 'can_export' => true, 'show_in_nav_menus' => null, 'show_in_menu' => null, 872 873 ); 873 874 $args = wp_parse_args($args, $defaults); … … 884 885 if ( null === $args->show_ui ) 885 886 $args->show_ui = $args->public; 887 888 // If not set, default to the setting for show_ui. 889 if ( null === $args->show_in_menu || ! $args->show_ui ) 890 $args->show_in_menu = $args->show_ui; 886 891 887 892 // Whether to show this type in nav-menus.php. Defaults to the setting for public. … … 1035 1040 * 1036 1041 * @access private 1042 * @since 3.0.0 1037 1043 */ 1038 1044 function _get_custom_object_labels( $object, $nohier_vs_hier_defaults ) { … … 1048 1054 return (object)$labels; 1049 1055 } 1056 1057 /** 1058 * Adds submenus for post types. 1059 * 1060 * @access private 1061 * @since 3.1.0 1062 */ 1063 function _add_post_type_submenus() { 1064 foreach ( get_post_types( array( 'show_ui' => true ) ) as $ptype ) { 1065 $ptype_obj = get_post_type_object( $ptype ); 1066 // Submenus only. 1067 if ( ! $ptype_obj->show_in_menu || $ptype_obj->show_in_menu === true ) 1068 continue; 1069 add_submenu_page( $ptype_obj->show_in_menu, $ptype_obj->labels->name, $ptype_obj->labels->name, $ptype_obj->cap->edit_posts, "edit.php?post_type=$ptype" ); 1070 } 1071 } 1072 add_action( 'admin_menu', '_add_post_type_submenus' ); 1050 1073 1051 1074 /**
Note: See TracChangeset
for help on using the changeset viewer.