Display users by number of comments.
You can display users by the number of comments using the following code. Just add to the Function.php file
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
function top_comment_authors($amount = 5) { global $wpdb; $results = $wpdb->get_results(' SELECT COUNT(comment_author_email) AS comments_count, comment_author_email, comment_author, comment_author_url FROM '.$wpdb->comments.' WHERE comment_author_email != "" AND comment_type = "" AND comment_approved = 1 GROUP BY comment_author_email ORDER BY comments_count DESC, comment_author ASC LIMIT '.$amount ); $output = " <ul>"; foreach($results as $result) { $output .= "</p> <li>".$result->comment_author."</li> <p>"; } $output .= "</ul>"; echo $output; } |
The withdrawal of users is carried out by calling the function:
1 |
<!--? top_comment_authors(); ?--> |
/*
Online tutoring services.
List of courses I teach
*/
- Basic web design course;
- Site layout;
- General course on CMS WordPress and continuation of the course on template development;
- Website development in PHP.