我想替换左上方仪表板中的Wordpress徽标?那里有一个' W'
这可能吗?
答案 0 :(得分:1)
是的,你可以,2种方式:
首先,您需要将自定义徽标另存为
custom-logo.png
文件 你的电脑。它的尺寸必须精确16 x 16px
。准备好自定义徽标后,需要将其上传到 使用FTP的
/wp-content/themes/your-theme/images
文件夹。如果你的主题 没有图像文件夹,那么你需要创建它。上传自定义徽标图片后,只需将此代码添加到您的 主题的
functions.php
文件或特定于网站的插件。
function wpb_custom_logo() {
echo '<style type="text/css">
#wpadminbar #wp-admin-bar-wp-logo > .ab-item .ab-icon:before {
background-image: url(' . get_bloginfo('stylesheet_directory') . '/images/custom-logo.png) !important;
background-position: 0 0;
color:rgba(0, 0, 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('wp_before_admin_bar_render', 'wpb_custom_logo');
您可以在此处找到更多信息:http://www.wpbeginner.com/wp-themes/adding-a-custom-dashboard-logo-in-wordpress-for-branding/
答案 1 :(得分:0)
function wpb_custom_logo() {
echo '
<style type="text/css">
#wpadminbar #wp-admin-bar-wp-logo > .ab-item .ab-icon:before {
background-image: url(' . get_bloginfo('stylesheet_directory') . '/images/custom-logo.png) !important;
background-position: 0 0;
color:rgba(0, 0, 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('wp_before_admin_bar_render', 'wpb_custom_logo');
上传徽标后将此代码添加到functions.php中(16x16)