comments表中的comment\\u count列是相关帖子上所有评论的总和。
要获取一段时间内的注释,必须对每组中的注释进行计数()。
$query="SELECT COUNT(comment_id) as num, ID, post_title
FROM $wpdb->posts wposts, $wpdb->comments wcomments
WHERE wposts.ID = wcomments.comment_post_ID
AND wposts.post_status=\'publish\'
AND wcomments.comment_approved=\'1\'
AND wcomments.comment_date > DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 1 WEEK)
GROUP BY wposts.ID
ORDER BY num DESC
LIMIT 0 , 10
";