display most commented post in SOME categories
-
Hi there,
Ik would like to display the most commented post in say category 1 and 5. Ho do I do that? I already found this code-snippet (which has the option to call it between dates), but don’t know how to make it include (or exclude) categories.
I hope somebody knows…
<?php $result = $wpdb->get_results("SELECT comment_count,ID,post_title, post_date FROM $wpdb->posts WHERE post_date BETWEEN '2008-01-01' AND '2199-12-31' ORDER BY comment_count DESC LIMIT 0 , 10"); foreach ($result as $topten) { $postid = $topten->ID; $title = $topten->post_title; $commentcount = $topten->comment_count; if ($commentcount != 0) { ?> <a href="<?php echo get_permalink($postid); ?>"><?php echo $title ?></a><br /> <?php } } ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘display most commented post in SOME categories’ is closed to new replies.