WP 2.1 和 ELA 的兼容性问题
看来 Wordpress 2.1 真是个 trouble maker,和 Extended Live Archive 又发现兼容性问题,鉴于用 ELA 的人还挺多的,我拿来说说。估计他们官方又会跑出来说“是你们插件作者的错,不是我们的错”了,嘿嘿。
症状:如果你注意到的话,在 WP 2.1 中,ELA 会把新建立的页面当成文章显示出来。
那么为什么会出现这种情况呢?因为 WP 2.1 把数据库结构作了调整,以前区分文章和页面是用 post_status 这个 field 的值。如果是 post_status = ‘publish’ 那就是文章,如果 post_status = ’static’ 那说明这是页面。而到了 WP 2.1 上,页面的 post_status 也变成 ‘publish’ 了,区分文章还是页面用 post_type 判断,post_type = ‘post’ 为文章,post_type = ‘page’ 为页面。可 ELA 不知道这点啊,它还是按老方法来判断,当然会造成误判了。
修补:
- /plugins/af-extended-live-archive/af-extended-live-archive-include.php
- 寻找 post_status = ‘publish’
- 替换为 post_type = ‘post’ AND post_status = ‘publish’
注意找到 p.post_status = ‘publish’ 这种,替换后应为 p.post_type = ‘post’ AND p.post_status = ‘publish’,而不是 p.post_type = ‘post’ AND post_status = ‘publish’。
除了上面说的问题,我以前也曾指出过,如果想把任意页面设置成首页,你需要关闭 ELA,否则无效。
升级 WP 2.1 后会遇到总总问题,如果不是特别需要新的功能,不妨先缓缓,等各种问题都解决了后再升级不迟。
更新:附上我改好的 af-extended-live-archive-include.php 文件,需要的朋友可以下载,把扩展名改成 .php 后直接覆盖原文件。点此下载 (适用版本:R18)

