最新评论先不起作用

时间:2016-06-05 作者:RubenGeert

我想先列出我的最新评论,但似乎没有任何效果。在我设置的仪表板中

enter image description here

在里面comments.php 我有

<?php wp_list_comments(array(
    \'reverse_top_level\' => true,
    \'callback\'      =>  \'custom_comments_callback\',
    \'avatar_size\'   =>  50,
    \'reply_text\'    =>  \'Reply to this comment\'
    )); ?>
并且在functions.php 我补充道

if (!function_exists(\'custom_reverse_comments\')) {
    function custom_reverse_comments($comments) {
        return array_reverse($comments);
    }   
}
最早的评论仍显示在顶部。例如,请参见introduction to SPSS.

奇怪的是,在我的网站的本地版本上,使用完全相同的设置/文件,最终的结果是不同的(更好但并不完美)。

1 个回复
SO网友:webHasan

您不需要回调函数。只有reverse\\u top\\u level:true是查找您要执行的操作。只需从数组中删除“callback”=>“custom\\u comments\\u callback”。

<?php wp_list_comments(array(
   \'reverse_top_level\' => true,
   \'avatar_size\'   =>  50,
   \'reply_text\'    =>  \'Reply to this comment\'
)); ?>

相关推荐

Help with comments.php

我有一个带有短代码的页面,显示数据库中的信息。我已将其设置为允许在页面上发表评论。我遇到的问题是,当我单击“提交评论”时,我会收到以下消息:注意:事件中未定义索引:id。php在线989这一行从用户单击以访问此页面的链接中获取id,这很好。是否有方法通过注释传递此id。php页面以确保页面加载正常?以下是评论。php代码:if (have_comments()) { wp_list_comments(\'\'); } $comments_args = array(