Skip to content

Instantly share code, notes, and snippets.

Created June 10, 2013 17:50
Show Gist options
  • Save anonymous/5750810 to your computer and use it in GitHub Desktop.
Save anonymous/5750810 to your computer and use it in GitHub Desktop.
<?php
/**
* I want to get this query to also desplay events that are on the current day.
* Any Ideas on how I can do that?
* I added '>=' instead of '>' but it did not do anything.
* I assume time() does not work when comparing to date becuase the date starts at 0:00, so anytime on the current day will be past 0:00
*/
$args = array(
'post_type' => 'event',
'meta_key' => '_event_date',
'orderby' => '_event_date',
'order' => 'asc',
'posts_per_page' => 3,
'meta_query' => array(array(
'key' => '_event_date',
'value' => time(),
'compare' => '>='
))
);
$events = new WP_Query($args);
get_header(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment