Support » Plugins » Hacks » popular posts this month not all time!

  • Hi!
    We have this site:
    on the left side is the popular posts by this code:

    $side_posts = new WP_query();
                                        $side_posts->query(array('category__in'=>array(16), 'posts_per_page'=>3, 'post_type'=>'post','meta_key'=>'_hafla_pageview','meta_value'=>0, 'meta_compare'=>'>', 'orderby'=>'meta_value_num', 'order'=>'DESC'));

    but it’s the popular posts by all times, and I want popular posts this month.

    how can i achieve this?

    thanks in advance,

    Adam Shriki.

Viewing 1 replies (of 1 total)
  • Moderator bcworkz


    Take at look at Query time Parameters and the examples provided. Getting posts in the current calendar month is straight forward. Use $today = getdate(); then add 'monthnum' => $today["mon"], to your query array. Getting posts from the last 30 days is more complicated, but achievable.

Viewing 1 replies (of 1 total)
  • The topic ‘popular posts this month not all time!’ is closed to new replies.