Advertisement
GerinG

Top commented posts 30 days

Feb 6th, 2012
325
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.61 KB | None | 0 0
  1. <?php
  2. global $post;
  3. function filter_where($where = '') {
  4. $where .= " AND post_date > '" . date('Y-m-d', strtotime('-30 days')) . "'";
  5. return $where;}
  6. add_filter('posts_where', 'filter_where');
  7. query_posts('post_type=post&posts_per_page=5&orderby=comment_count&order=DESC);
  8. while (have_posts()): the_post();
  9. $thumb = get_the_post_thumbnail($post->ID,array(100,60), true);?>
  10. <div class="relatedpost">
  11. <div class="thumb"><?php echo $thumb; ?></div>
  12. <div class="rtitle"><a href="<?php the_permalink(); ?>"title="<?php the_title(); ?>"><?php the_title(); ?></a></div>
  13. </div>
  14. <?php
  15. endwhile;
  16. wp_reset_query();
  17. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement