Created
January 29, 2014 09:47
-
-
Save webhasan/8684722 to your computer and use it in GitHub Desktop.
wp: post query by comment_count
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$pop = $wpdb->get_results("SELECT id,post_title,guid FROM {$wpdb->prefix}posts WHERE post_type='post' ORDER BY comment_count DESC LIMIT 10"); | |
foreach($pop as $post) : ?> | |
<li><a href="<?php echo $post->guid; ?>"><?php echo get_the_post_thumbnail($post->id); ?></li> | |
<?php endforeach; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment