Popular posts by comments

/ Published in: PHP
Save to your folder(s)

Copy this code and paste it in your HTML
  1. $pop = $wpdb->get_results("SELECT id, post_title, comment_count FROM {$wpdb->prefix}posts WHERE post_type='post' ORDER BY comment_count DESC LIMIT 10");
  3. foreach($pop as $post) : ?>
  4. <li> <?php echo $post->post_title; ?> </li>
  5. <?php endforeach; ?>

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.