如何从管理员更改 WordPress 默认徽标?

Hem*_*mar 5 wordpress

WordPress 徽标

我想创建一个自定义徽标,因此我需要更改 WordPress 徽标的默认徽标。

Sun*_*rma 5

这是将正确覆盖管理徽标的函数(插入到functions.php中):

/**
* 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');
Run Code Online (Sandbox Code Playgroud)

哈!