Title: query_posts and date_query?
Last modified: September 1, 2016

---

# query_posts and date_query?

 *  [amurado](https://wordpress.org/support/users/amurado/)
 * (@amurado)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/query_posts-and-date_query/)
 * Hi,
 * I have the following code in my archive page and I was wondering how I can make
   it so it shows posts only after today’s date?
 * `<?php query_posts($query_string . '&orderby=date&order=ASC&posts_per_page=72');?
   >`
 * In other files, I use the following code to achieve it, but I can’t seem to work
   out how to implement the same in the structure above.
 * `'date_query' => array( 'after' => "today" )`
 * Thank you

Viewing 8 replies - 1 through 8 (of 8 total)

 *  [cedcommerce](https://wordpress.org/support/users/cedcommerce/)
 * (@cedcommerce)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/query_posts-and-date_query/#post-7495645)
 * Hi amurado,
    Please try the following code:
 *     ```
       <?php
        query_posts(
         array(
          'post_type' => 'post',
          'orderby' => 'meta_value_num',
          'order' => 'DESC',
          'meta_query' => array(
           array(
            'value'         => date('Ymd', strtotime("today")),
            'compare'       => '>=',
            'type'          => 'DATE'
           )
          )
         )
        );
       ?>
       ```
   
 * Hope this will help you.
 *  [Tanveer Sure](https://wordpress.org/support/users/tsure/)
 * (@tsure)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/query_posts-and-date_query/#post-7495650)
 * Hi,
 * Have you looked at this post below? It has a similar question answered:
 * [https://wordpress.org/support/topic/show-events-with-start-dates-after-today-custom-post-type?replies=3](https://wordpress.org/support/topic/show-events-with-start-dates-after-today-custom-post-type?replies=3)
 *  Thread Starter [amurado](https://wordpress.org/support/users/amurado/)
 * (@amurado)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/query_posts-and-date_query/#post-7495656)
 * [@cedcommerce](https://wordpress.org/support/users/cedcommerce/) Tried that and
   changed the post type to “movies” and it didn’t work. It now doesn’t show any
   posts on the front.
 * [@tsure](https://wordpress.org/support/users/tsure/) Just took a look at that
   thread and it seems pretty similar to the above code and it didn’t work.
 * Not sure what I’m doing wrong.
 *  [Tanveer Sure](https://wordpress.org/support/users/tsure/)
 * (@tsure)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/query_posts-and-date_query/#post-7495702)
 * I am re-reading your question again and it says “I have the following code in
   my archive page and I was wondering how I can make it so it shows posts only 
   after today’s date?”
 * I am thinking, wait, *after* today’s date? future posts are not published!
 * Am I not understanding this correctly?
 *  Thread Starter [amurado](https://wordpress.org/support/users/amurado/)
 * (@amurado)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/query_posts-and-date_query/#post-7495735)
 * [@tsure](https://wordpress.org/support/users/tsure/): Yes, that’s correct. I’ve
   set it so scheduled posts show up on the front end. This is a custom post type
   for “movies” to use as a movie database. So future movies will need to be shown.
 *  [cedcommerce](https://wordpress.org/support/users/cedcommerce/)
 * (@cedcommerce)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/query_posts-and-date_query/#post-7495737)
 * As you’re saying that I need a post that will be published in future but you 
   want to need it now.
    The code I’ve provided earlier output blank because you
   don’t have a post right now published with that date. If you want to show all
   the future movies, you can publish a post of upcoming movies and assign them 
   a category and can fetch those posts by that category.
 *  Thread Starter [amurado](https://wordpress.org/support/users/amurado/)
 * (@amurado)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/query_posts-and-date_query/#post-7495738)
 * [@cedcommerce](https://wordpress.org/support/users/cedcommerce/) Is there no 
   way to fetch all posts AFTER today with your code? Using something like the below:
 * `'date_query' => array( 'after' => "today" )`
 * Thank you
 *  [cedcommerce](https://wordpress.org/support/users/cedcommerce/)
 * (@cedcommerce)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/query_posts-and-date_query/#post-7495747)
 * Yeah it’s possible to fetch all the posts after today, but make sure that you
   have published those posts for future date.
    try the following code:
 *     ```
       <?php
       query_posts(
        array(
         'post_type'       => 'movies',
         'post_status'     => 'future',
        )
       );
       ?>
       ```
   
 * Use the above query posts with the given parameter and fetch the posts.
    You’ll
   get all the posts, published for after today.

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘query_posts and date_query?’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 8 replies
 * 3 participants
 * Last reply from: [cedcommerce](https://wordpress.org/support/users/cedcommerce/)
 * Last activity: [9 years, 10 months ago](https://wordpress.org/support/topic/query_posts-and-date_query/#post-7495747)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
