本文整理自网络,侵删。
在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
相关阅读 >>
使用 conditional menus 插件让 wordpress 在不同页面显示不同菜单
wordpress统计当前页面数据库查询次数及消耗时间的方法
深入解析wordpress中加载模板的get_template_part函数
wordpress升级版本及安装插件出现”problem with the ssl ca cert”的解决办法
关于wordpress的seo优化相关的一些php页面脚本技巧
更多相关阅读请进入《wordpress》频道 >>
相关推荐
评论
管理员已关闭评论功能...
- 欢迎访问木庄网络博客
- 可复制:代码框内的文字。
- 方法:Ctrl+C。