Support » Themes and Templates » How can I achive this?

  • I use this code combination in order to show most commented 5 posts af all time.

    I use latest wordpress version.

    But I want to make it a little different.

    How can I show most commented ( or most viewed ) posts of the recent ( last ) week ?

    I have Post-Plugin Library installed.

    This is what I use now:

    <div class="top">
    					<span class="heading1"><span>Populer Posts</span></span>
    						$sql = "
    							SELECT *
    							FROM $wpdb->posts
    							WHERE 	post_date_gmt > ".(time()-strtotime('-2 weeks'))." AND post_type = 'post'
    							ORDER BY comment_count DESC LIMIT 5
    						$top_posts = $wpdb->get_results($sql);
    						foreach ($top_posts as $post)  {
    							<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a><span><a class="comments" href="<?php the_permalink(); ?>#comment"><?php echo $post->comment_count; ?> Yorum</a>Kategori: <?php the_category(', '); ?></span></li>
    				<div class="clear"></div>
Viewing 1 replies (of 1 total)
  • I feel so foolish not to have recognized it.

    when -2 weeks is replaced by -1 week

    will it work?

Viewing 1 replies (of 1 total)
  • The topic ‘How can I achive this?’ is closed to new replies.