I want to display posts in a slider that are marked as "featured".
For this i created a post meta box with a checkbox.
Now i have the following query
SELECT wp_posts.* FROM wp_posts, wp_postmeta WHERE wp_posts.ID = wp_postmeta.post_id AND wp_postmeta.meta_key = '' AND wp_postmeta.meta_key = 'theme_featured_post' AND wp_postmeta.meta_value = '1' AND wp_posts.post_status = 'publish' AND wp_posts.post_type = 'post' AND wp_posts.post_date < NOW() ORDER BY wp_posts.post_date DESC
But i need another value from the post_meta table as well. So how can I select the second meta_key in the query. I could query it with
get_post_meta( $postid, 'custom_image')
Cause transactions are expensive, i would like to include it in one query.
The custom_image is an image id and has its own row in the table.