this is my problem: I add a Custom Field to some posts to show them in a flash ticker in the blog header.
The Key is '
ticker' and its value is '
Now, I want to exclude these posts from the Loop in the home, and show only posts that don't have that custom field (
I tried also with a custom query like:
$arts = $wpdb->get_results("SELECT P2C.*, POST.ID, POST.post_title, POST.post_date
FROM $wpdb->posts POST, $wpdb->postmeta P2C
WHERE POST.ID = P2C.post_id AND P2C.meta_key != 'ticker' AND POST.post_status = 'publish'
ORDER BY POST.post_date DESC");
but the problem is that if a Post has another custom field, the query doesn't work, probably because there's more than a record in the
I could use this
$arts = $wpdb->get_results("SELECT ID,post_title,post_date FROM $wpdb->posts WHERE post_status = 'publish' AND ID NOT IN (SELECT post_id FROM $wpdb->postmeta WHERE meta_key = 'ticker') ORDER BY post_date DESC");
but unfortunately doesn't work with mySQL version available on my hosting service.
I read also the Query Posts on the Wiki, but it seems applicable only to categories.
Thanks in advance.