Return to Snippet

Revision: 21998
at December 28, 2009 11:37 by mdrisser


Initial Code
<ul>
<?php
$result = $wpdb->get_results("SELECT comment_count,ID,post_title, post_date FROM $wpdb->posts WHERE post_date BETWEEN '2009-01-01' AND '2009-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) {
    ?>
         <li></li>
    <?php }
}
?>
</ul>

Initial URL
http://webdesignledger.com/tips/13-useful-code-snippets-for-wordpress-development

Initial Description
From Web Design Ledger "13 Useful Code Snippets for WordPress Development"
For additional information, see the link above.

Initial Title
Wordpress - Display the Most Commented Posts of 2009

Initial Tags
wordpress

Initial Language
PHP