Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function my_searchwp_include( $ids ) {
- if ( isset( $_REQUEST['country'] ) ) {
- // limit the results to all of the chosen countries
- $args = array(
- 'post_type' => 'any',
- 'nopaging' => true,
- 'fields' => 'ids',
- 'tax_query' => array(
- array(
- 'taxonomy' => 'country',
- 'field' => 'slug',
- 'terms' => $_REQUEST['country'],
- ),
- ),
- );
- $country_ids = get_posts( $args );
- $c_ids = array_merge( $ids, $country_ids );
- $c_ids = array_unique( $c_ids );
- }
- if ( isset( $_REQUEST['soort'] ) ) {
- // limit the results to all of the chosen countries
- $args = array(
- 'post_type' => 'any',
- 'nopaging' => true,
- 'fields' => 'ids',
- 'tax_query' => array(
- array(
- 'taxonomy' => 'soort',
- 'field' => 'slug',
- 'terms' => $_REQUEST['soort'],
- ),
- ),
- );
- $soort_ids = get_posts( $args );
- $s_ids = array_merge( $ids, $soort_ids );
- $s_ids = array_unique( $s_ids );
- }
- if ( isset( $_REQUEST['thema'] ) ) {
- // limit the results to all of the chosen countries
- $args = array(
- 'post_type' => 'any',
- 'nopaging' => true,
- 'fields' => 'ids',
- 'tax_query' => array(
- array(
- 'taxonomy' => 'thema',
- 'field' => 'slug',
- 'terms' => $_REQUEST['thema'],
- ),
- ),
- );
- $thema_ids = get_posts( $args );
- $t_ids = array_merge( $ids, $thema_ids );
- $t_ids = array_unique( $t_ids );
- }
- $ids = array_merge( $ids, $country_ids, $soort_ids, $thema_ids );
- return $ids;
- }
- add_filter( 'searchwp_include', 'my_searchwp_include' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement