I am trying to return posts that contain meta value and ones that don't in one query. Is this possible?
So in plain English, I am trying to get posts that have a meta key of date and value of date and posts that don't have date set as well.
This is what I have so far and it isn't working. UPDATED - i have now added another meta to the post to make it easier...I added no-date meta so instead of checking for it being empty, I am checking if no-date is set. So my revised code now looks like this but I can't seem to order it now.
$args = array( 'cat' => $type, 'post_status' => 'publish', 'post_type' => 'post', 'paged' => get_query_var('paged'), 'posts_per_page' => 10, 'orderby' => 'meta_value', 'meta_query' => array( 'relation' => 'OR', array('key' => 'date', 'value' => date('m-d-Y'), 'compare' => '>=', 'type' => 'char'), array('key' => 'no-date', 'value' => '1', 'compare' => '=') ) );
So now this "seems" to return what i want...however I can't seem to sort it using orderby...I want the date to be closet first and future date last and for the no-dates ones to come after the ones with date via the post date.