0

我得到了这条简单的线:get_comments( 'post_id='.$newpost->ID.'');基于http://codex.wordpress.org/Function_Reference/get_comments

它工作正常,但我想以不同的顺序订购帖子。我已经尝试了很多编写它的方法,但它似乎从来没有工作过。

我将如何添加这些参数之一?:

$orderby (string) (可选) 设置用于排序评论的字段。默认值:comment_date_gmt $order (string) (optional) 如何排序

$orderby。有效值:'ASC' - 升序(从最低到最高)。'DESC' - 降序(从最高到最低)。默认值:DESC

谢谢你们的帮助!

4

1 回答 1

1

用你的变量创建一个数组:

get_comments( array('orderby' => 'ID', 'order' => 'ASC', 'post_id' => $newpost->ID) );
于 2012-09-16T00:19:08.930 回答