I need to get attachment images with horizontal orientation. I tried to use
Meta_Query but I don't know how to compare two values (width and height) from one associative array that is in
wp_postmeta table. I don't have any specific values of width and height, I only need to compare this values which is in associative array.
Also tried to do this with
$wpdb custom query:
$attach_ids = $wpdb->query( " SELECT wp_posts.ID FROM wp_posts, wp_postmeta WHERE EXISTS (SELECT * FROM wp_postmeta WHERE meta_key = '_wp_attachment_metadata' AND meta_value= ???) AND wp_posts.ID = wp_postmeta.post_id AND wp_posts.post_type = 'attachment' AND wp_posts.post_mime_type = 'image/jpeg' ORDER BY RAND() LIMIT 0, 6" );
Can anyone understand my problem and help? P.S. Sorry for my English.