Exclude comments from loop
-
I’m using a comment rating (karma) plugin to display “top rated comments” list above the standard comment loop.
In comments.php
<?php global $wp_query; $comment_arr = $wp_query->comments; usort($comment_arr, 'comment_comparator'); wp_list_comments('callback=aaa&page=%orderby=comment_karma', $comment_arr); ?>
In functions.php
function comment_comparator($a, $b) { $compared = 0; if($a->comment_karma != $b->comment_karma) { $compared = $a->comment_karma < $b->comment_karma ? 1:-1; } return $compared; } if($a->comment_karma == 0) { $compared = $compared2; }
Basically the code checks for rating and sorts comments according to the value, the problem is it returns the full list of comments (only sorted via rating), where I would like it only to return comments with > 1 rating.
Thanks
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Exclude comments from loop’ is closed to new replies.