diff --git a/wp-admin/includes/plugin.php b/wp-admin/includes/plugin.php index 0c71449378..482535fd7d 100644 --- a/wp-admin/includes/plugin.php +++ b/wp-admin/includes/plugin.php @@ -557,6 +557,29 @@ function add_menu_page( $page_title, $menu_title, $access_level, $file, $functio return $hookname; } +function add_object_page( $page_title, $menu_title, $access_level, $file, $function = '', $icon_url = '') { + global $menu, $admin_page_hooks, $_wp_last_object_menu; + + $file = plugin_basename( $file ); + + $admin_page_hooks[$file] = sanitize_title( $menu_title ); + + $hookname = get_plugin_page_hookname( $file, '' ); + if (!empty ( $function ) && !empty ( $hookname )) + add_action( $hookname, $function ); + + if ( empty($icon_url) ) + $icon_url = 'images/menu/generic.png'; + + $menu[$_wp_last_object_menu][4] = ''; // Remove menu-top-last + + $_wp_last_object_menu++; + + $menu[$_wp_last_object_menu] = array ( $menu_title, $access_level, $file, $page_title, 'menu-top-last ' . $hookname, $hookname, $icon_url ); + + return $hookname; +} + function add_submenu_page( $parent, $page_title, $menu_title, $access_level, $file, $function = '' ) { global $submenu; global $menu; diff --git a/wp-admin/menu.php b/wp-admin/menu.php index ad2cd0b7b4..a398358b93 100644 --- a/wp-admin/menu.php +++ b/wp-admin/menu.php @@ -54,6 +54,8 @@ $menu[20] = array( __('Pages'), 'edit_pages', 'page-new.php', '', '', 'menu-page $menu[25] = array( sprintf( __('Comments %s'), "" . number_format_i18n($awaiting_mod) . "" ), 'edit_posts', 'edit-comments.php', '', 'menu-top-last', 'menu-comments', 'images/menu/comments.png' ); $submenu['edit-comments.php'][15] = array( __('Comments'), 'edit_posts', 'edit-comments.php' ); +$_wp_last_object_menu = 25; // The index of the last top-level menu in the object menu group + $menu[29] = array( '', 'read', '', '', 'wp-menu-separator' ); $menu[30] = array( __('Appearance'), 'switch_themes', 'themes.php', '', 'menu-top-first', 'menu-appearance', 'images/menu/appearance.png' );