Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function artists_search_country($country_alt){
- global $wpdb;
- $querystr = "
- SELECT wposts.*, meta1.meta_value as meta_value1, meta2.meta_value as meta_value2, meta3.meta_value as meta_value3
- FROM $wpdb->posts wposts, $wpdb->postmeta meta1, $wpdb->postmeta meta2, $wpdb->postmeta meta3
- WHERE (wposts.ID = meta1.post_id
- AND wposts.ID = meta2.post_id
- AND wposts.ID = meta3.post_id
- )
- AND (
- (
- meta1.meta_key = '_artist_country' AND meta1.meta_value = '$country_alt')
- OR
- (meta2.meta_key = '_artist_country_sub' AND meta2.meta_value = '$country_alt')
- )
- AND meta3.meta_key = '_artist_artist_last_name'
- AND wposts.post_status = 'publish'
- AND wposts.post_type = 'artists'
- ORDER BY meta3.meta_value ASC
- ";
- $myposts = $wpdb->get_results($querystr, OBJECT);
- return $myposts;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement