I need to get posts that have two meta-values.
It tried the following code, but this is getting empty result
<?php $featuredquery = " SELECT wposts.* FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta WHERE wposts.ID = wpostmeta.post_id AND (wpostmeta.meta_key = 'article_level' AND wpostmeta.meta_value = 'Hovedsak') AND (wpostmeta.meta_key = 'article_genre' AND wpostmeta.meta_value = 'X6.no (Spill og underholdning)') AND wposts.post_status = 'publish' AND wposts.post_type = 'post' AND wposts.post_date < NOW() ORDER BY wposts.post_date DESC LIMIT 0 , 4 "; $featuredposts = $wpdb->get_results($featuredquery, OBJECT); ?>
Any ideas for this? I tried searching around, but didn't find anything that suited me.. :/
Thanks for all help