Update search form

This commit is contained in:
Hoang Huu 2019-09-17 10:01:35 +07:00
parent d8e95a1dc5
commit f872b4f79a
6 changed files with 131 additions and 23 deletions

View File

@ -139,19 +139,20 @@ function is_single_agency() {
*/
function opalestate_search_properties_form_styles() {
return apply_filters( 'opalestate_search_properties_form_styles', [
'search-form-h' => esc_html__( 'Advanced V1 Form', 'opalestate-pro' ),
'advanced-v2' => esc_html__( 'Advanced V2 Form', 'opalestate-pro' ),
'advanced-v3' => esc_html__( 'Advanced V3 Form', 'opalestate-pro' ),
'advanced-v4' => esc_html__( 'Advanced V4 Form', 'opalestate-pro' ),
'advanced-v5' => esc_html__( 'Advanced V5 Form', 'opalestate-pro' ),
'advanced-v6' => esc_html__( 'Advanced V6 Form', 'opalestate-pro' ),
'search-form-v' => esc_html__( 'Vertical Advanced Form', 'opalestate-pro' ),
'search-form-v2' => esc_html__( 'Vertical Advanced V2 Form', 'opalestate-pro' ),
'search-form-v3' => esc_html__( 'Vertical Advanced V3 Form', 'opalestate-pro' ),
'simple-city' => esc_html__( 'Simple City Form', 'opalestate-pro' ),
'simple-keyword' => esc_html__( 'Simple Keyword Form', 'opalestate-pro' ),
'collapse-city' => esc_html__( 'Collapse City Form', 'opalestate-pro' ),
'collapse-keyword' => esc_html__( 'Collapse Keyword Form', 'opalestate-pro' ),
'search-form-h' => esc_html__( 'Advanced V1', 'opalestate-pro' ),
'advanced-v2' => esc_html__( 'Advanced V2', 'opalestate-pro' ),
'advanced-v3' => esc_html__( 'Advanced V3', 'opalestate-pro' ),
'advanced-v4' => esc_html__( 'Advanced V4', 'opalestate-pro' ),
'advanced-v5' => esc_html__( 'Advanced V5', 'opalestate-pro' ),
'advanced-v6' => esc_html__( 'Advanced V6', 'opalestate-pro' ),
'search-form-v' => esc_html__( 'Vertical Advanced', 'opalestate-pro' ),
'search-form-v2' => esc_html__( 'Vertical Advanced V2', 'opalestate-pro' ),
'search-form-v3' => esc_html__( 'Vertical Advanced V3', 'opalestate-pro' ),
'simple-city' => esc_html__( 'Simple City', 'opalestate-pro' ),
'simple-keyword' => esc_html__( 'Simple Keyword', 'opalestate-pro' ),
'collapse-city' => esc_html__( 'Collapse City', 'opalestate-pro' ),
'collapse-keyword' => esc_html__( 'Collapse Keyword', 'opalestate-pro' ),
'collapse-advanced' => esc_html__( 'Collapse Advanced', 'opalestate-pro' ),
] );
}
@ -513,7 +514,7 @@ function opalestate_get_image_placeholder( $size = '', $url = false ) {
}
function opalestate_get_image_placeholder_src() {
return OPALESTATE_PLUGIN_URL . 'assets/images/placeholder.png';
return OPALESTATE_PLUGIN_URL . 'assets/images/placeholder.png';
}
/**

View File

@ -94,23 +94,32 @@ class Opalestate_Taxonomy_Categories {
}
public static function dropdown_list( $selected = 0 ) {
$id = "opalestate_category" . rand();
$id = 'property_category' . rand();
$args = [
'show_option_none' => esc_html__( 'Select category', 'opalestate-pro' ),
'show_option_none' => esc_html__( 'Select Category', 'opalestate-pro' ),
'id' => $id,
'class' => 'form-control',
'show_count' => 0,
'hierarchical' => '',
'name' => 'label',
'value_field' => 'slug',
'name' => 'types',
'selected' => $selected,
'taxonomy' => 'opalestate_category',
'value_field' => 'slug',
'taxonomy' => 'property_category',
'echo' => 0,
];
return wp_dropdown_categories( $args );
$label = '<label class="opalestate-label opalestate-label--category" for="' . esc_attr( $id ) . '">' . esc_html__( 'Category', 'opalestate-pro' ) . '</label>';
echo $label . wp_dropdown_categories( $args );
}
public static function get_multi_check_list( $scategory ) {
$list = self::get_list();
echo opalestate_terms_multi_check( $list, $scategory );
}
}
Opalestate_Taxonomy_Categories::init();

View File

@ -105,7 +105,7 @@ class Opalestate_Taxonomy_Type {
public static function dropdown_list( $selected = 0 ) {
$id = "opalestate_types" . rand();
$id = 'opalestate_types' . rand();
$args = [
'show_option_none' => esc_html__( 'Select Type', 'opalestate-pro' ),

View File

@ -0,0 +1,91 @@
<?php
/**
* The template for collapse advanced search
*
* @version 1.0.0
*/
defined( 'ABSPATH' ) || exit;
$unique_id = esc_attr( wp_unique_id() );
$GLOBALS['group-info-column'] = 3;
if ( isset( $nobutton ) && $nobutton ) {
$grid = [
0 => 7,
1 => 4,
2 => 1,
3 => 0,
];
} else {
$grid = [
0 => 6,
1 => 3,
2 => 1,
3 => 2,
];
}
$display_more_options = isset( $display_more_options ) ? $display_more_options : true;
$form_classes = [
'opalestate-search-form',
'opalestate-search-form--collapse-advanced',
isset( $hidden_labels ) && $hidden_labels ? 'hidden-labels' : '',
];
?>
<form class="<?php echo esc_attr( implode( ' ', array_map( 'sanitize_html_class', $form_classes ) ) ); ?>" action="<?php echo esc_url( opalestate_get_search_link() ); ?>" method="GET">
<div class="searchbox-top">
<?php echo opalestate_load_template_path( 'search-box/fields/status-bar', [ 'style' => 2 ] ); ?>
</div>
<div class="searchbox-main">
<div class="searchbox-field searchbox-field--city-text">
<?php echo opalestate_load_template_path( 'search-box/fields/search-city-text' ); ?>
</div>
<div class="searchbox-field searchbox-field--types">
<?php echo opalestate_load_template_path( 'search-box/fields/types' ); ?>
</div>
<div class="searchbox-field searchbox-field--categories">
<?php echo opalestate_load_template_path( 'search-box/fields/categories' ); ?>
</div>
<div class="searchbox-field searchbox-field--collapse">
<button type="button" class="opal-collapse-button opalestate-collapse-btn btn btn-primary" data-collapse="#collapse-city-<?php echo esc_attr( $unique_id ); ?>">
<i class="fa fa-caret-down" aria-hidden="true"></i>
</button>
</div>
<?php if ( ! isset( $nobutton ) || ! $nobutton ) : ?>
<div class="searchbox-field searchbox-field--submit">
<?php echo opalestate_load_template_path( 'search-box/fields/submit-button' ); ?>
</div>
<?php endif; ?>
</div>
<div id="collapse-city-<?php echo esc_attr( $unique_id ); ?>" class="opal-collapse-container collapse-city-inputs">
<div class="opal-row">
<?php echo opalestate_load_template_path( 'search-box/fields/group-info' ); ?>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
<?php echo opalestate_load_template_path( 'search-box/fields/price' ); ?>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
<?php echo opalestate_load_template_path( 'search-box/fields/areasize' ); ?>
</div>
</div>
<?php
if ( $display_more_options ) {
echo opalestate_load_template_path( 'search-box/fields/more-options' );
}
?>
</div>
<?php do_action( 'opalestate_after_search_properties_form' ); ?>
</form>

View File

@ -0,0 +1,8 @@
<?php
$scategories = isset( $_GET['cat'] ) ? $_GET['cat'] : -1;
if ( isset( $ismultiple ) ) {
Opalestate_Taxonomy_Categories::get_multi_check_list( $scategories );
} else {
Opalestate_Taxonomy_Categories::dropdown_list();
}

View File

@ -1,9 +1,8 @@
<?php
$stypes = isset( $_GET['types'] ) ? $_GET['types'] : -1;
if( isset($ismultiple) ) {
if ( isset( $ismultiple ) ) {
Opalestate_Taxonomy_Type::get_multi_check_list( $stypes );
} else {
Opalestate_Taxonomy_Type::dropdown_list();
}
?>