I want to create a custom logo so I need change the default logo of the wordpress logo.
Asked
Active
Viewed 8,527 times
6 Answers
4
Here is the function (inserted into functions.php) which will correctly override the admin logo:
/**
* customize the admin logo that appears in the header
* http://www.wpbeginner.com/wp-themes/adding-a-custom-dashboard-logo-in-wordpress-for- branding/
* @author Paul Bredenberg
*/
function htx_custom_logo() {
echo '
<style type="text/css">
#wp-admin-bar-wp-logo > .ab-item .ab-icon {
background-image: url(' . get_bloginfo('stylesheet_directory') . '/assets/images/dashboard-logo.png) !important;
background-position: 0 0;
}
#wpadminbar #wp-admin-bar-wp-logo.hover > .ab-item .ab-icon {
background-position: 0 0;
}
</style>
';
}
//hook into the administrative header output
add_action('admin_head', 'htx_custom_logo');
Take from Here: http://goo.gl/GuDZM6
HTH!

Sunny Sharma
- 4,688
- 5
- 35
- 73
-
1I also had to do #wpadminbar #wp-admin-bar-wp-logo>.ab-item .ab-icon:before{ content: none} because wp logo remained there – pyjavo Sep 18 '14 at 15:38
0
function my_login_logo() { ?>
<style type="text/css">
body.login div#login h1 a {
background-image: url(<?php echo get_stylesheet_directory_uri(); ?>/images/site-login-logo.png);
padding-bottom: 30px;
}
</style>
0
Change your dashboard logo to custom logo with this code:
add_action('admin_head', 'my_custom_logo');
function my_custom_logo() {
echo '
<style type="text/css">
#header-logo { background-image: url('.get_bloginfo('template_directory').'/images/custom-logo.gif) !important; }
</style>
';
}

Zohair Baloch
- 21
- 1
0
I did few arrangement:
- support the fullscreen mode
- use the favicon of the site so it is automatically customized for multisites, and you can put some default image if there is no favicon)
I put "width: 12px" to have a square shape for the favicon cover background
If it can help someone here is the code :
function my_custom_admin_logo() {
echo '
<style type="text/css">
#wpadminbar #wp-admin-bar-wp-logo > .ab-item .ab-icon:before {content:none;}
#wpadminbar #wp-admin-bar-wp-logo > a {
background-image: url(' . get_site_icon_url() . ') !important;
background-size: cover !important;
}
#wpadminbar #wp-admin-bar-wp-logo > .ab-item .ab-icon {width: 12px;}
@media screen and (max-width:782px){ #wpadminbar #wp-admin-bar-wp-logo > .ab-item .ab-icon {width: 46px;} }
a.edit-post-fullscreen-mode-close.has-icon {
background-image: url(' . get_site_icon_url() . ');
background-size: cover;
}
.edit-post-fullscreen-mode-close.has-icon > svg > path { display: none;}
</style>
';
}
//hook into the administrative header output
add_action('wp_before_admin_bar_render', 'my_custom_admin_logo');

Pierre Ferron
- 1
- 1
0
Sunny's answer only overrides the icon of the item. If you want to delete the item completely you can do this:
function htx_custom_logo() {
echo '
<style type="text/css">
#wpadminbar #wp-admin-bar-wp-logo>.ab-item {
display:none;
}
</style>
';
}
//hook into the administrative header output
add_action('admin_head', 'htx_custom_logo');

Amin Memariani
- 830
- 3
- 17
- 39