Add custom links to WordPress Admin bar
WordPress 3.1 added the handy admin bar. It kinda hovers there giving you some quick and easy links for updating and editing your site. Unfortunatly WordPress doesn’t include any kind of admin side managemetn of this bar. I’ve seen a load of themes that have been customising and adding links to this but wanted to add some of my own. A quick google search found this great article.
The Basic gist of it is below, but the article explains in much greater detail. This needs to go inside you themes functions.php file by the way.
function nlk_admin_bar_render() {
global $wp_admin_bar;
// we can remove a menu item, like the COMMENTS link, just by knowing the right $id
$wp_admin_bar->remove_menu('comments');
// we can add a submenu item too
$wp_admin_bar->add_menu( array(
'parent' => 'new-content',
'id' => 'new_media',
'title' => __('Media'),
'href' => admin_url( 'media-new.php')
) );
}
// and we hook our function via
add_action( 'wp_before_admin_bar_render', 'nlk_admin_bar_render' );


Recent Comments