/ Published in: PHP
From Web Design Ledger "13 Useful Code Snippets for WordPress Development"
For additional information, see the link above.
For additional information, see the link above.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<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>
URL: http://webdesignledger.com/tips/13-useful-code-snippets-for-wordpress-development