本文整理自网络,侵删。
在wordpress主题中的header.php中,有一个wp_head()函数,表面上看不出什么玄机,只能在浏览器中查看源代码才能看出它所生成的如下代码:代码如下:
<style type=”text/css” media=”print”>#wpadminbar { display:none; }</style>
<style type=”text/css”>
html { margin-top: 28px !important; }
* html body { margin-top: 28px !important; }
</style>
这样使页面顶部总空白28px ,虽然我已经在全局的css文件中设置*{margin:0px; padding:0px;}了,但还是无法解决!当然删除wp_head()后就好了,但是这个函数是系统函数,最好不要删。
最后在一个外国论坛找到解决方法:在主题中的footer.php中的</body>前加上<?php wp_footer();?>。
<style type=”text/css” media=”print”>#wpadminbar { display:none; }</style>
<style type=”text/css”>
html { margin-top: 28px !important; }
* html body { margin-top: 28px !important; }
</style>
这样使页面顶部总空白28px ,虽然我已经在全局的css文件中设置*{margin:0px; padding:0px;}了,但还是无法解决!当然删除wp_head()后就好了,但是这个函数是系统函数,最好不要删。
最后在一个外国论坛找到解决方法:在主题中的footer.php中的</body>前加上<?php wp_footer();?>。
标签:WordPress
相关阅读 >>
网易蜂巢的docker容器中架设或迁移wordpress的教程
更多相关阅读请进入《wordpress》频道 >>
相关推荐
评论
管理员已关闭评论功能...
- 欢迎访问木庄网络博客
- 可复制:代码框内的文字。
- 方法:Ctrl+C。