Skip to content

Instantly share code, notes, and snippets.

@joeyz
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joeyz/f52c797ceffdf938fce1 to your computer and use it in GitHub Desktop.
Save joeyz/f52c797ceffdf938fce1 to your computer and use it in GitHub Desktop.
Hide passed custom posts by datepicker value
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
// WP_Query arguments
$args = array (
'post_type' => 'events',
'pagination' => true,
'paged' => $paged,
'meta_query' => array(
array(
'key' => 'event_date',
'value' => date('Ymd', strtotime('now')),
'type' => 'numeric',
'compare' => '>=',
)
),
'meta_key' => 'event_date',
'orderby' => 'meta_value_num',
'order' => 'ASC'
);
// The Query
$query_events = new WP_Query( $args );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment