Created
May 29, 2013 05:33
-
-
Save UmeshSingla/5668176 to your computer and use it in GitHub Desktop.
Wordpress Popular Post Sorted 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 | |
/* Add this where you want to display popular post sorted by comment count */ | |
$args = array( 'orderby' => 'comment_count', 'numberposts' => $rtp_post_count, 'post_status' => 'publish' ); | |
$posts = get_posts($args); ?> | |
<!-- Output Markup --> | |
<ul class="rtp-most-popular-wrapper"><?php | |
$count=1; | |
for($i=0; $i<sizeof($posts); $i++){?> | |
<li> | |
<a href="<?php echo get_permalink($posts[$i]->ID); ?>" title="<?php echo $posts[$i]->post_title; ?>" target="_blank"><?php echo $count.'. '.$posts[$i]->post_title; ?></a> | |
</li><?php | |
$count++; | |
}?> | |
</ul> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment