How to Display Most Commented Posts in WordPress
Retrieve the most commented WordPress posts:
$most_commented = wp_get_recent_posts( "post_type=post&numberposts=10&order=desc&orderby=comment_count&post_status=publish", ARRAY_A ); foreach( $most_commented as $article ) { echo '<li>'.number_format(intval($article['comment_count'])).' Comments - <a href="'.get_permalink( $article['ID'] ).'" title="'.get_the_title( $article['ID'] ).'">'.get_the_title( $article['ID'] ).'</a></li>'; } |
More Related Posts
- [2016/09/22] WordPress Uploaded Images are Blank
- [2016/06/12] Can’t See or Edit Content of Pos...
- [2016/05/31] Get Post Modification Date of a WordPr...
- [2016/06/04] Get Image Src for All Images on a Post...
- [2016/05/24] Get Post Permalink on WordPress
- [2016/05/24] Get Post Creation Date of a WordPress ...
- [2016/05/14] How to Display Recent Posts in WordPre...
- [2016/05/24] How to Manually Update WordPress