Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ADDED TO THEME UNDER propertyhive/global/search-form.php
- <div class="control control-exclude">
- <label><input type="checkbox" name="exclude" value="1"<?php echo ( (isset($_GET['exclude']) && $_GET['exclude'] == '1') ? ' checked' : '' ); ?>> Exclude under offer / let agreed properties</label>
- </div>
- // --------------
- // ADDED TO functions.php
- add_action( 'propertyhive_property_query', 'exclude' );
- function exclude( $q ){
- global $post;
- if (is_post_type_archive( 'property' ) && isset($_GET['exclude']))
- {
- $tax_query = $q->get( 'tax_query' );
- $tax_query[] = array(
- 'taxonomy' => 'availability',
- 'field' => 'name',
- 'terms' => array( 'Under Offer', 'Sold STC', 'Sold', 'Let Agreed', 'Let' ),
- 'operator' => 'NOT IN',
- );
- $q->set( 'tax_query', $tax_query );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement