移除wordpress中wp_head函数,头部28px空白

星期六, 2012-11-24 | Author: Lee | php, wordpress | 5,349 views

在使用管理员登录的时候总是发现网站顶部有一点空白,开始以为网站的插件问题,后来查到原来是管理员登录后的一个问题:

移除方法一:设置用户后台设置即可
用户登录后—–>登录后台—>在用户中心—->我的资料中—->取消“显示管理工具栏”中的相关选项,就可以了

方法二:修改代码 看到那个28px了吧,修改之即可

文件:wp-includes/admin-bar.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/**
 * Style and scripts for the admin bar.
 *
 * @since 3.1.0
 *
 */
function wp_admin_bar_header() { ?>
<style type="text/css" media="print">#wpadminbar { display:none; }</style>
<?php
}
 
/**
 * Default admin bar callback.
 *
 * @since 3.1.0
 *
 */
function _admin_bar_bump_cb() { ?>
<style type="text/css">
	html { margin-top: 28px !important; }
	* html body { margin-top: 28px !important; }
</style>
<?php
}
 
/**
 * Set the display status of the admin bar
 *
 * This can be called immediately upon plugin load.  It does not need to be called from a function hooked to the init action.
 *
 * @since 3.1.0
 *
 * @param bool $show Whether to allow the admin bar to show.
 * @return void
 */
function show_admin_bar( $show ) {
	global $show_admin_bar;
	$show_admin_bar = (bool) $show;
}

Tags:

文章作者: Lee

本文地址: https://www.pomelolee.com/1050.html

除非注明,Pomelo Lee文章均为原创,转载请以链接形式标明本文地址

No comments yet.

Leave a comment

Search

文章分类

Links

Meta