Add Menu & Logo to WordPress Admin bar

WordPress Dashboard Customize (Part 2)
Access the Active Theme of your website and open the functions.php file. Paste the snips below into the file then test.

[php]
/*
* Add a simple menu & link that opens in a new window
* Change the Menu ‘title’ name and ‘href’ link.
*/
function rt_admin_bar() {
global $wp_admin_bar;
//Add a link called ‘RT_Menu’
$wp_admin_bar->add_menu( array(
‘id’ => ‘RT_Menu’,
‘title’ => ‘<img src="’.get_template_directory_uri(__FILE__).’/images/rt_logo.png"/>’,
‘href’ => ‘http://www.royaltechbd.com/’,
‘meta’ => array( target => ‘_blank’ )
));

//THEN add a sub-link called ‘RoyalTechnologies’
$wp_admin_bar->add_menu( array(
‘id’ => ‘RoyalTechnologies’,
‘title’ => ‘Royal Technologies’,
‘href’ => ‘http://www.royaltechbd.com’,
‘meta’ => array( target => ‘_blank’ ),
‘parent’=>’RT_Menu’
));

//THEN add a sub-link called ‘twitter’
$wp_admin_bar->add_menu( array(
‘id’ => ‘blog’,
‘title’ => ‘Shamokal Darpon’,
‘href’ => ‘http://www.shamokaldarpon.com’,
‘meta’ => array( target => ‘_blank’ ),
‘parent’=>’RT_Menu’
));

//THEN add a sub-link called ‘facebook’
$wp_admin_bar->add_menu( array(
‘id’ => ‘facebook’,
‘title’ => ‘Mehdi Akram – Facebook’,
‘href’ => ‘https://www.facebook.com/mehediakram’,
‘meta’ => array( target => ‘_blank’ ),
‘parent’=>’RT_Menu’
));

//THEN add a sub-link called ‘twitter’
$wp_admin_bar->add_menu( array(
‘id’ => ‘twitter’,
‘title’ => ‘Mehdi Akram – Twitter’,
‘href’ => ‘https://www.twitter.com/mehdiakram’,
‘meta’ => array( target => ‘_blank’ ),
‘parent’=>’RT_Menu’
));

//THEN add a sub-link called ‘googleplus’
$wp_admin_bar->add_menu( array(
‘id’ => ‘googleplus’,
‘title’ => ‘Mehdi Akram – Google Plus’,
‘href’ => ‘https://plus.google.com/u/0/111670173570585456902’,
‘meta’ => array( target => ‘_blank’ ),
‘parent’=>’RT_Menu’
));
}
add_action( ‘admin_bar_menu’, ‘rt_admin_bar’, 10 );
[/php]
The add_action you can set the menu position:
10 = Before the WP Logo
15 = Between the logo and My Sites
25 = After the My Sites menu
100 = End of menu

After

Leave a Reply

×

Your Cart

No products in the cart.
Start shopping

About Us

Royal Technologies is a System Integration house that supports Web Design, Web Hosting, Domain Registration, Search Engine Optimizing, IT Consulting, Remote or Telephone Support and Software Development. In simpler terms it’s an IT Company dealing in various aspects of implementation and maintenance of computerization. We have learnt from experience and have molded ourselves to be complete IT Company.

CONTACT US

Location

Copyright © 2008-2024 Royal Technologies. All rights reserved.
Development by Royal Technologies