Add logo to admin menu in my plugin

So as the first option was loading wired i have come to a better solution.
what we will do in this case is to create a new menu item, put it in first position, give a custom class, needed to add cutom css style for that item. For this we will:

  • create a function to add new menu item
  • create a function to load custom stylesheet to admin panel
  • and create the new css style to override default css for that item

This will be the function to add new menu:

add_action('admin_menu', 'shomtek_admin_menu');

function shomtek_admin_menu() {
    global $menu;
    $url="http://www.shomtek.com/";
    $menu[0] = array( __('SHOMTek'), 'read', $url, 'shomtek-logo', 'shomtek-logo');
}

Adding custom stylesheet to wp-admin head

add_action('admin_head', 'shomtek_admin_style');

function shomtek_admin_style() {
    echo '<link rel="stylesheet" href="' . get_template_directory_uri() . '/css/admin_style.css" type="text/css" media="all" />';
}

At the end the custom style for that menu item

#adminmenu a.shomtek-logo{
    display: block;
    background: url(http://www.shomtek.com/wp-content/uploads/2014/01/logo.png) no-repeat center center;
    background-size: 140px 40px;
    width: 140px;
    opacity: 0.6;
    height: 40px;
    margin: 0 auto;
    padding: 10px 5px;
}

#adminmenu a.shomtek-logo div.wp-menu-name {
    display: none;
}

This is all, tested and it works perfect 😉