How to change the wordpress default logo from the

2019-01-26 21:11发布

问题:

I want to create a custom logo so I need change the default logo of the wordpress logo.

回答1:

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!



回答2:

Here is a great plugin for this, and much more. White Label CMS



回答3:

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>



回答4:

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>
';
}


标签: wordpress