Send this to a friend
1 <ul>
2 <?php $result = $wpdb->get_results("SELECT comment_count,ID,post_title FROM $wpdb->posts ORDER BY comment_count DESC LIMIT 0 , 5");
3 foreach ($result as $post) {
4 setup_postdata($post);
5 $postid = $post->ID;
6 $title = $post->post_title;
7 $commentcount = $post->comment_count;
8 if ($commentcount != 0) { ?>
9 <li><a href="<?php echo get_permalink($postid); ?>" title="<?php echo $title ?>">
10 <?php echo $title ?></a> {<?php echo $commentcount ?>}</li>
11 <?php } } ?>
12 </ul>
<ul>
<?php $result = $wpdb->get_results("SELECT comment_count,ID,post_title FROM $wpdb->posts ORDER BY comment_count DESC LIMIT 0 , 5");
foreach ($result as $post) {
setup_postdata($post);
$postid = $post->ID;
$title = $post->post_title;
$commentcount = $post->comment_count;
if ($commentcount != 0) { ?>
<li><a href="<?php echo get_permalink($postid); ?>" title="<?php echo $title ?>">
<?php echo $title ?></a> {<?php echo $commentcount ?>}</li>
<?php } } ?>
</ul>