This commit is contained in:
Hoang Huu 2020-06-16 17:34:51 +07:00
parent e2db40a211
commit 22c65f696a
4 changed files with 42 additions and 25 deletions

View File

@ -77,11 +77,19 @@ class OpalEstate_Search {
$tax_query = []; $tax_query = [];
if ( isset( $_GET['location'] ) && $_GET['location'] != -1 ) { if ( isset( $_GET['location'] ) && $_GET['location'] != -1 ) {
$tax_query[] = [ if ( is_array( $_GET['location'] ) ) {
'taxonomy' => 'opalestate_location', $tax_query[] = [
'field' => 'slug', 'taxonomy' => 'opalestate_location',
'terms' => sanitize_text_field( $_GET['location'] ), 'field' => 'slug',
]; 'terms' => opalestate_clean( $_GET['location'] ),
];
} else {
$tax_query[] = [
'taxonomy' => 'opalestate_location',
'field' => 'slug',
'terms' => sanitize_text_field( $_GET['location'] ),
];
}
} }
if ( isset( $_GET['state'] ) && $_GET['state'] != -1 ) { if ( isset( $_GET['state'] ) && $_GET['state'] != -1 ) {
@ -101,11 +109,19 @@ class OpalEstate_Search {
} }
if ( isset( $_GET['city'] ) && $_GET['city'] != -1 ) { if ( isset( $_GET['city'] ) && $_GET['city'] != -1 ) {
$tax_query[] = [ if ( is_array( $_GET['city'] ) ) {
'taxonomy' => 'opalestate_city', $tax_query[] = [
'field' => 'slug', 'taxonomy' => 'opalestate_city',
'terms' => sanitize_text_field( $_GET['city'] ), 'field' => 'slug',
]; 'terms' => opalestate_clean( $_GET['city'] ),
];
} else {
$tax_query[] = [
'taxonomy' => 'opalestate_city',
'field' => 'slug',
'terms' => sanitize_text_field( $_GET['city'] ),
];
}
} }
if ( isset( $_GET['types'] ) && $_GET['types'] != -1 ) { if ( isset( $_GET['types'] ) && $_GET['types'] != -1 ) {
@ -165,6 +181,8 @@ class OpalEstate_Search {
]; ];
} }
$tax_query = apply_filters( 'opalestate_search_results_tax_query', $tax_query );
if ( $tax_query ) { if ( $tax_query ) {
$args['tax_query'] = [ 'relation' => 'AND' ]; $args['tax_query'] = [ 'relation' => 'AND' ];
$args['tax_query'] = array_merge( $args['tax_query'], $tax_query ); $args['tax_query'] = array_merge( $args['tax_query'], $tax_query );

View File

@ -3,7 +3,7 @@
* Plugin Name: Opal Estate Pro * Plugin Name: Opal Estate Pro
* Plugin URI: https://wpdocs.gitbook.io/opal-estate/ * Plugin URI: https://wpdocs.gitbook.io/opal-estate/
* Description: Opal Real Estate Plugin is an ideal solution and brilliant choice for you to set up a professional estate website. * Description: Opal Real Estate Plugin is an ideal solution and brilliant choice for you to set up a professional estate website.
* Version: 1.5.6 * Version: 1.5.7
* Author: WPOPAL * Author: WPOPAL
* Author URI: http://www.wpopal.com * Author URI: http://www.wpopal.com
* Requires at least: 4.9 * Requires at least: 4.9

View File

@ -1,13 +1,13 @@
<?php <?php
global $post; global $post;
if ( opalestate_get_option( 'enable_single_enquire_form' , 'on' ) != 'on' ) { if ( opalestate_get_option( 'enable_single_enquire_form', 'on' ) !== 'on' ) {
return; return;
} }
$message = sprintf( __( 'Hi, I am interested in %s (Property ID: %s)', 'opalestate-pro' ), get_the_title(), get_the_ID() );
$property_id = get_the_ID(); $property_id = get_the_ID();
$infor_id = apply_filters( 'opalestate_contact_form_infor_id', $property_id, $property_id );
$message = sprintf( __( 'Hi, I am interested in %s (Property ID: %s)', 'opalestate-pro' ), get_the_title(), $infor_id );
$heading = esc_html__( 'Enquire about property', 'opalestate-pro' ); $heading = esc_html__( 'Enquire about property', 'opalestate-pro' );
$object = OpalEstate_User_Message::get_instance(); $object = OpalEstate_User_Message::get_instance();
$fields = $object->get_equiry_form_fields( $message ); $fields = $object->get_equiry_form_fields( $message );

View File

@ -1,12 +1,11 @@
<?php <?php
$layout = 'collapse-city'; $layout = apply_filters( 'opalestate_archive_search_block_form_layout', 'collapse-city' );
$settings = array(); $settings = [];
?> ?>
<div class="opalestate-archive-search-block"> <div class="opalestate-archive-search-block">
<div class="container"> <div class="container">
<div class="search-properies-form"> <div class="search-properies-form">
<?php echo opalestate_load_template_path( 'search-box/'.$layout , $settings ); ?> <?php echo opalestate_load_template_path( 'search-box/' . $layout, $settings ); ?>
</div> </div>
</div>
</div> </div>
</div>