Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Set any existing query string to a local variable
- $query_string = $_REQUEST;
- // Setup the arguments for the query. Notice it is an OR query.
- $search['post_type'] = 'places';
- $search['tax_query'] = array(
- 'relation' => 'or',
- );
- // Since we are using checkboxes, we'll want to loop over the request
- foreach($query_string as $key => $value) {
- array_push(
- $search['tax_query'],
- array(
- 'taxonomy' => 'place_category',
- 'field' => 'slug',
- 'terms' => $value
- )
- );
- }
- // Loop over the query's results
- while ( $the_search_results->have_posts() ) : $the_search_results->the_post();
- // All my display stuff goes in here.
- endwhile;
- // Reset Query
- wp_reset_query();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement