- A+
所属分类:Wordpress
【关于升级到Wordpress 3.3后HotNewsPro主题背景失效】Wordpress 3.3 版本正式发布当天我就已经下载试用,只是因为时间原因没有及时查看与鄙人目前所用主题HotNewsPro的兼容性,而只是在本地测试了一下,发现最明显的一个BUG就是原来设置的背景图片不见了,然后用Firebug查看了一下代码原来是页面背景CSS样式有了变化,
Wordpress 3.2.1 下的:
- <style type="text/css">
- body { background-image: url('http://localhost:8082/wp-content/uploads/2011/10/bg3.gif'); background-repeat: repeat; background-position: top left; background-attachment: fixed; }
- </style>
WordPress 3.3下的:
- <style type="text/css">
- body.custom-background { background-image: url('http://localhost:8082/wp-content/uploads/2011/10/bg3.gif'); background-repeat: repeat; background-position: top left; background-attachment: fixed; }
- </style>
对比后发现,多了一个.custom-background样式类,于是乎顺藤摸瓜找到了wp-includes目录下的theme.php,其中函数_custom_background_cb中有这么一句
- <style type="text/css">
- body.custom-background { <?php echo trim( $style ); ?> }
- </style>
我的解决方法:在body后面加一个逗号","就好了,“body,.custom-background”。不知道这样改对不对,但至少现在来说背景显示问题是解决了呢。
完美解决方法见“WordPress 3.3 版背景功能失效解决方案 | 知更鸟”:http://zmingcx.com/wordpress-3-3-version-of-the-background-function-failure-solution.html