1 reputation
bio website
location
age
visits member for 2 years, 2 months
seen Jan 14 '13 at 19:05

May
8
comment Custom SELECT Query With Multiple Meta Values (Ordering Problem)
Okay, cheers Milo. That has shed some light. Specifically, there's definitely an error in the sorting: Array ( [key] => event_enddate [value] => 2012/05/08 [compare] => >= ) ) [meta_value] => 2012/05/08 [meta_compare] => >= [orderby] => meta_value [order] => ASC [error] I'll see if I can work out what's causing it, but it may well be the date format I guess.
May
8
comment Custom SELECT Query With Multiple Meta Values (Ordering Problem)
$today = date( 'Y/m/d' ); $args = array( 'tax_query' => array( array( 'taxonomy' => 'category', 'field' => 'ID', 'terms' => 15 ) ), 'meta_query' => array( 'relation' => 'OR', array( 'key' => 'event_enddate', 'value' => $today, 'compare' => '>=' ), array( 'key' => 'event_date', 'value' => $today, 'compare' => '>=' ) ) ); I've tried adding this to the bottom to get the ordering but then I just get the wrong values. Why is this? What else can I try? 'meta_key' => 'event_date', 'orderby' => 'meta_value_num'
May
8
comment Custom SELECT Query With Multiple Meta Values (Ordering Problem)
Hey Milo, I tried your code and it didn't work at first (the posts that were being shown were featuring all kinds of dates), so I've been tinkering with it a bit and have now got it so that it's showing exactly the posts I want, but as soon as I add any info on the ordering it goes wrong! Here's the code which brings my unordered data perfectly:
May
8
asked Custom SELECT Query With Multiple Meta Values (Ordering Problem)