I know this questions have been asked many times, but I can't get my code work ;-(
I'm trying to filter a listing aof posts with a query base on two custom fields.
So here's my code :
$today = date( 'd-m-Y' ); $where .= " AND ($wpdb->posts.ID in ( select $wpdb->postmeta.post_id from $wpdb->postmeta JOIN $wpdb->postmeta meta1 ON meta1.post_id = p.ID JOIN $wpdb->postmeta meta2 ON meta2.post_id = p.ID WHERE meta1.meta_key = 'end_date' AND meta2.meta_key >='".$today."' AND meta1.meta_value = '2-3-ans' AND meta2.meta_value = 'on'))"; return $where;
Surely there's something I miss because it's not working ;-(
The original code was
$where .= " AND ($wpdb->posts.ID in (select $wpdb->postmeta.post_id from $wpdb->postmeta where $wpdb->postmeta.meta_key='end_date' and $wpdb->postmeta.meta_value>='".$today."')) ";
Thanks in advance guys for helping