Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function get_schools_by_custom_search() {
- global $wpdb;
- $type = $_GET['type'];
- $programme = $_GET['programme'];
- $type_sql = " AND wpostmeta.meta_key = 'type' AND wpostmeta.meta_value = '$type' ";
- $programme_sql = " AND wpostmeta.meta_key = 'programme' AND wpostmeta.meta_value LIKE '%$programme%' ";
- $querystr = "
- SELECT DISTINCT wposts.*
- FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta
- WHERE wposts.post_status = 'publish'
- AND wposts.post_type = 'post'
- " . $type_sql . "
- " . $programme_sql . "
- ORDER BY wposts.post_title DESC
- ";
- $searched_posts = $wpdb->get_results($querystr);
- return $searched_posts;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment