Created
August 15, 2013 05:39
-
-
Save rileypaulsen/6238534 to your computer and use it in GitHub Desktop.
list upcoming events in a CPT based on a postmeta value for date (meta query)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$args = array( | |
'post_type'=>'event', | |
'numberposts'=>-1, | |
'post_status'=>'publish', | |
'no_found_rows'=>true, | |
'meta_query'=>array( | |
array( | |
'key'=>'date', | |
'value'=>date('Y-m-d'), | |
'compare'=>'>=' | |
) | |
), | |
'meta_key' => 'date', | |
'orderby' => 'meta_value_num' | |
); | |
$events = query_posts($args); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment