Posted By

mdrisser on 12/28/09


Tagged

wordpress comments


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

maxvee8


Wordpress - Display the Most Commented Posts of 2009


 / Published in: PHP
 

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

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

  1. <ul>
  2. <?php
  3. $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");
  4.  
  5. foreach ($result as $topten) {
  6. $postid = $topten->ID;
  7. $title = $topten->post_title;
  8. $commentcount = $topten->comment_count;
  9. if ($commentcount != 0) {
  10. ?>
  11. <li></li>
  12. <?php }
  13. }
  14. ?>
  15. </ul>

Report this snippet  

You need to login to post a comment.