也许你是为了好看,也许你是为别人建站……你可能会需要修改WordPress后台仪表盘左上角的Logo。
方法2:修改WordPress代码
此方法适用于在有一定PHP基础的用户。
首先,您需要将自定义Logo:“custom-logo.png”文件通过FTP上传到/wp-content/themes/your-theme/images文件夹中,注意Logo尺寸必须是16 x 16像素。
如果您的主题没有图像文件夹,则需要创建它。
上传您的自定义徽标图像后,只需将此代码添加到您的主题的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');
此代码已经简单地添加了在WordPress管理栏中显示自定义Logo所需的CSS,如果你有需要可以删除并自定义。
文章末尾固定信息
我的微信
这是我的微信扫一扫

我的微信
我的微信公众号
我的微信公众号扫一扫

我的公众号
评论