[英]WordPress “wp_list_comments” custom order
我正在使用WordPress 3.0.1,并希望使用评级自定义字段从帖子中订购评论。
这可能吗? 我已经在使用wp_list_comments的callback属性来自定义注释的外观。
不幸的是,这样我只能一个接一个地访问注释,而不会影响所有结果数组的顺序。
我已经有一张桌子,上面有用户的所有投票。
提前致谢。
// get comments of post 1234
$comments = get_comments( array('post_id' => 1234) );
// ... order your comments collection using php (eg. usort) here ...
// print your comments
wp_list_comments( array( 'callback' => 'woocommerce_comments' ), $comments);
尝试$comments = get_comments('postId=x');
。 它应该通过评论ID索引。 然后,您可以在表格中查找评论评分。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.