Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
WordPress Admin Bar Menu Example
add_action('admin_bar_menu', 'webmaster_admin_bar_menu', 99);
function webmaster_admin_bar_menu() {
global $wp_admin_bar;
$menus[] = array(
'id' => 'webmaster',
'title' => 'Web Master',
'href' => 'http://yourdomain.com/',
'meta' => array(
'target' => 'blank'
)
);
$menus[] = array(
'id' => 'basecamp',
'parent' => 'webmaster',
'title' => 'Basecamp',
'href' => 'http://youraccount.basecamphq.com/',
'meta' => array(
'target' => 'blank'
)
);
$menus[] = array(
'id' => 'email',
'parent' => 'webmaster',
'title' => 'Email Jeff',
'href' => 'mailto:you@yourdomain.com',
'meta' => array(
'target' => 'blank'
)
);
foreach ( apply_filters( 'render_webmaster_menu', $menus ) as $menu )
$wp_admin_bar->add_menu( $menu );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment