WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So, I'm using the following to filter posts:

                    $paged = is_front_page() ? get_query_var( 'page' ) : get_query_var( 'paged' );
                    $args['paged'] = $paged;
                    $args['post_type'] = 'coupons';
                    if(isset($_GET['sort']) && $_GET['sort'] == 'populair') {
                        $args['orderby'] = 'comment_count';
                        $args['order'] = 'desc';

                    elseif(isset($_GET['sort']) && $_GET['sort'] == 'best-beoordeeld-oplopend') {
                        $args['paged'] = $paged;
                        $args['post_type'] = 'coupons';
                        $args['orderby'] = 'meta_value';
                        $args['meta_key'] =  'gemiddeld_beoordeeld_met';
                        $args['order'] = 'ASC';  



So, I know how to filter by monthnum, but unfortunately that's not sufficient. I am trying to query posts from the latest 7 days. Any clue, anybody?

share|improve this question
Have you tried WP_Date_Query? – toscho Dec 17 '13 at 15:26
I guess When should you use WP_Query vs query_posts() vs get_posts()? is for you worth reading too, to clear up use cases of those functions. – ialocin Dec 17 '13 at 15:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.