SHOW:
|
|
- or go back to the newest paste.
| 1 | - | <?php |
| 1 | + | |
| 2 | ||
| 3 | function ac_show_search_results( $query ) {
| |
| 4 | ||
| 5 | if ( ! $query->is_main_query() ) | |
| 6 | return; | |
| 7 | - | if ( ! $query->is_page( 'some-page-slug' ) ) |
| 7 | + | |
| 8 | if ( ! $query->is_page( 'about' ) ) | |
| 9 | return; | |
| 10 | ||
| 11 | // Stop trying to load the page | |
| 12 | $query->set( 'pagename', '' ); | |
| 13 | ||
| 14 | $tax_query = array(); | |
| 15 | ||
| 16 | if ( ! empty( $_GET['funeral-state'] ) ) {
| |
| 17 | $tax_query[] = array( | |
| 18 | 'taxonomy' => 'ac_state', | |
| 19 | 'terms' => $_GET['funeral-state'], | |
| 20 | 'field' => 'name', | |
| 21 | ); | |
| 22 | } | |
| 23 | ||
| 24 | if ( ! empty( $_GET['funeral-city'] ) ) {
| |
| 25 | $tax_query[] = array( | |
| 26 | 'taxonomy' => 'ac_city', | |
| 27 | 'terms' => $_GET['funeral-city'], | |
| 28 | 'field' => 'name', | |
| 29 | ); | |
| 30 | } | |
| 31 | ||
| 32 | if ( ! empty( $tax_query ) ) | |
| 33 | $query->set( 'tax_query', $tax_query ); | |
| 34 | ||
| 35 | if ( ! empty( $_GET['ac-search'] ) ) | |
| 36 | $query->set( 's', $_GET['ac-search'] ); | |
| 37 | } |