most commented Posts in WP


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <ul>
  2. <?php query_posts('orderby=comment_count&posts_per_page=>5');
  3. if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
  4. <li><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?> (<?php comments_number('0','1','%'); ?>)</a></li>
  5. <?php endwhile; ?>
  6. <?php else : ?>
  7. <li>Sorry, no posts were found.</li>
  8. <?php endif; ?>
  9. </ul>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.