/* Check out this snippet that I use on all my sites.
It adds links to the admin-bar "site name" in the top left corner of the admin bar.
It links to the most commonly used pages that I like - you obviously can extend
it with new items that link to wherever you want.
*/
//Add custom CSS shortcut to adminbar
add_action( 'admin_bar_menu', 'toolbar_css_shortcut', 996 );
function toolbar_css_shortcut( $wp_admin_bar ) {
$str = "customize.php?autofocus[control]=fl-css-code";
$ur = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$url = admin_url();
if (current_user_can( 'administrator')){
$args = array(
'id' => 'css_shortcut',
'title' => 'CSS Shortcut',
'href' => $url . $str . '&url=' . $ur ,
'meta' => array( 'class' => 'my-toolbar-page' )
);
$wp_admin_bar->add_node( $args );
//add submenu to site-name link for quick access to plugins
$args = array(
'id' => 'pluginshortcut',
'title' => 'Plugins',
'href' => admin_url( 'plugins.php' ),
'parent' => 'site-name'
);
$wp_admin_bar->add_node( $args );
$args = array(
'id' => 'addpluginshortcut',
'title' => 'Add Plugins',
'href' => admin_url( 'plugin-install.php?tab=upload' ),
'parent' => 'site-name'
);
$wp_admin_bar->add_node( $args );
$args = array(
'id' => 'mediashortcut',
'title' => 'View Media',
'href' => admin_url( 'upload.php' ),
'parent' => 'site-name'
);
$wp_admin_bar->add_node( $args );
$args = array(
'id' => 'forceupdate',
'title' => 'Check Updates',
'href' => admin_url( 'update-core.php?force-check=1' ),
'parent' => 'site-name'
);
$wp_admin_bar->add_node( $args );
}
}