Most commented / popular posts and offset
I am using this code to show 3 most popular posts based on number of comments : <?php $pop_posts = 3; $popularposts = “SELECT $wpdb->posts.ID, $wpdb->posts.post_title, COUNT($wpdb->comments.comment_post_ID) AS ‘stammy’ FROM $wpdb->posts, $wpdb->comments WHERE comment_approved = ‘1’ AND $wpdb->posts.ID=$wpdb->comments.comment_post_ID AND post_status=”publish” AND comment_status=”open” GROUP BY $wpdb->comments.comment_post_ID ORDER BY stammy DESC LIMIT “.$pop_posts; $posts = $wpdb->get_results($popularposts); if($posts){ … Read more