Created
January 11, 2012 16:04
-
-
Save chibani/1595359 to your computer and use it in GitHub Desktop.
WordPress : Load custom posts using their custom fields
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
//WordPress Query to load custom posts using their custom fields | |
$myquery = new WP_Query(array( | |
'post_type' => 'mycustom', | |
'posts_per_page' => 15, | |
'orderby' => 'meta_value', | |
'meta_key'=>'mycustom_date_start', | |
'order' => 'ASC', | |
'meta_query'=>array( | |
'relation'=>'AND', | |
array( | |
'key' => 'mycustom_date_start', | |
'value' => date('Y-m-d'), | |
'compare' => '>=', | |
'type' => 'DATE' | |
) | |
) | |
) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment