Created
March 4, 2011 17:50
-
-
Save beaucollins/855375 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<?php | |
query_posts( array( | |
'post_type' => 'event', // only query events | |
'meta_key' => 'event_date', // load up the event_date meta | |
'orderby' => 'meta_value', // sort by the event_date | |
'order' => 'asc', // ascending, so earlier events first | |
'meta_query' => array( // restrict posts based on meta values | |
'key' => 'event_date', // which meta to query | |
'value' => array('2011-01-01','2011-02-01'), // value for comparison | |
'compare' => 'BETWEEN', // method of comparison | |
'type' => 'DATE' // datatype, we don't want to compare the string values | |
) // end meta_query array | |
) // end array | |
); // close query_posts call |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment