WP2.5.1评论关闭消失

因为升级至2.5英文版后无法开启评论功能的问题,在升级至2.5.1后已经解决,再次证明盲目升级的后果。

你也以后注意呀,小心为好。进入http://simplelive.org/guest-book给我留言。

关于评论显示顺序的修改如下,使得评论最新内容显示在最上位置。

以下内容引自http://www.thinkagain.cn

Latest Updated:无需修改源代码即可以实现评论显示倒序。在评论模板comments.php中找到下列语句:

<?php if ($comments) : ?>

在其后面添加上让评论倒序的代码:

<?php $comments = array_reverse($comments) ?>
*************************

WordPress默认的评论(留言)顺序是按照时间顺序升序来显示的,这样最新的评论会被显示在最下面,比较不符合阅读习惯(或者说是不符合我的阅读习惯吧)。通过更改comments_template的代码可以实现降序显示评论,从而将最新的评论显示在最前面。

进入Wordpress安装目录下的wp-includes目录,用文本编辑器打开comment-template.php文件,找到如下代码:

$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = '$post->ID' AND comment_approved = '1' ORDER BY comment_date");

在“ORDER BY comment_date”后面加上“DESC”,

$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = '$post->ID' AND comment_approved = '1' ORDER BY comment_date DESC");

保存退出,即可。这样评论的显示顺序就被改为以时间降序来显示了。

注:请将if else里面的3条get_results都加上DESC。

本方法在wordpress2.5.1中测试通过。

相关日志

分类: Life

日志评论

必须

必须, 但不公开

:wink: :-| :-x :twisted: :) 8-O :( :roll: :-P :oops: :-o :mrgreen: :lol: :idea: :-D :evil: :cry: 8) :arrow: :-? :?: :!:

使用新浪微博登陆

你也可选择直接在本站 注册

关于

广告 125×125

最新日志

本月最热日志

友情链接

广告 300×250