The new WordPress admin bar facilitates the access of backend and frontend to areas of the back end. Of course, this new control element of WordPress is expandable and can be adapted to the needs of the user. In some areas and for various needs, quick access to different areas is certainly interesting.
The newly created menus can be adapted as usual rights to the appropriate roles. A small example will demonstrate the integration.
Within the Admin Bar you can represent hierarchies, which are then coupled with a default Admin Bar with a mouse over effect. In the following example, a search on the WordPress Codex is integrated in the Admin bar. There are still things to do in terms of CSS, but I think this example points out some possibilities and can be used for your own ideas and requirements.
global $wp_admin_bar, $wpdb;
if ( !is_super_admin() || !is_admin_bar_showing() )
$codex_search = ‘
<form style=”margin: 5px 0 0;” action=”http://wordpress.org/search/do-search.php” method=”get”>
<input maxlength=”100″ name=”search” size=”13″ type=”text” value=”‘ . __( ‘Search the Codex’, ‘textdomain’ ) . ‘” />
/* Add the main siteadmin menu item */
$wp_admin_bar->add_menu( array( ‘id’ => ‘codex_search’, ‘title’ => __( ‘Search the Codex’, ‘textdomain’ ), ‘href’ => FALSE ) );
$wp_admin_bar->add_menu( array( ‘parent’ => ‘codex_search’, ‘title’ => $codex_search, ‘href’ => FALSE ) );
add_action( ‘admin_bar_menu’, ‘wp_codex_search_form’, 1000 );
add_menu() accepts certain parameters:
title– default false
href– default false,
parent– default false – pass the ID value for a submenu of that menu
id– defaults to a sanitized title value.
meta– default false – array of any of the following options:
array( 'html' => '', 'class' => '', 'onclick' => '', target => '');