Support

Account

Home Forums General Issues How can I display data after a dynamically generated date?

Solving

How can I display data after a dynamically generated date?

  • I’m working on a games release feature for a website I’m building. So far everything is going smooth, but I’m stuck on one area. For the listings on the front end, I want it to look at the “release_date” field and only display games that have a release date >= that date.

    I feel the code below should work, but it doesn’t return/display anything on the front end. And if I switch it to <=, it displays everything.

    Any help would be greatly appreciated! Below is the query code.

    $releasewindow = date('M j, Y', strtotime("-31 days"));
    	
        $q = new WP_Query(array(
            'post_type' => 'game_release',
            'posts_per_page' => 5,
    		'meta_key'  => 'release_date',
    		'orderby'   => 'release_date',
    		'order' => 'ASC',
    		'meta_query' => array(
            array(
                'key'     => 'release_date',
                'compare' => '>=',
                'value'   => $releasewindow,
            )
        ),
  • Is there anyone that can help out?

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.