I'm using WordPress 3.0.1 and want to order the comments from a post using a rating custom field.
Is this possible? I'm already using the callback property from wp_list_comments to customize the appearance of the comments.
Unfortunately this way I can only access the comments one by one and can't affect the order of the all result array.
I've already have a table with all the votes from the users.
Thanks in advance.
// 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);
Try $comments = get_comments('postId=x');
. It should be indexed by comment id. You can then look up the comment rating in your table.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.