Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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';  


                    }

                    query_posts($args);

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
4  
Have you tried WP_Date_Query? –  toscho Dec 17 '13 at 15:26
2  
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

 
discard

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

Browse other questions tagged or ask your own question.