This commit is contained in:
Lieu Le 2019-09-13 11:28:09 +07:00
commit 15ea1b7933
3 changed files with 24 additions and 14 deletions

View File

@ -93,13 +93,23 @@ class Opalestate_search_property_results_Elementor_Widget extends Opalestate_Ele
$this->add_control( $this->add_control(
'style', 'style',
[ [
'label' => esc_html__( 'Style Item Layout', 'opalestate-pro' ), 'label' => esc_html__( 'Style Grid Layout', 'opalestate-pro' ),
'type' => \Elementor\Controls_Manager::SELECT, 'type' => \Elementor\Controls_Manager::SELECT,
'options' => $this->get_template_post_type(), 'options' => $this->get_template_post_type(),
'default' => 'grid', 'default' => 'grid',
] ]
); );
$this->add_control(
'style_list',
[
'label' => esc_html__( 'Style List Layout', 'opalestate-pro' ),
'type' => \Elementor\Controls_Manager::SELECT,
'options' => $this->get_template_post_type(),
'default' => 'list',
]
);
$this->add_control( $this->add_control(
'column', 'column',
[ [

View File

@ -1,14 +1,11 @@
<?php <?php
$display = array( $display = [
'style' => $settings['style'], 'style' => $settings['style'],
'column' => $settings['column'] 'style_list' => $settings['style_list'],
); 'column' => $settings['column'],
// echo time().'<pre> ha congtein' . print_r( $display ,1 ).'</pre>'; ];
?> ?>
<div class="opalesate-properties-ajax opalesate-properties-results" data-mode="html"> <div class="opalesate-properties-ajax opalesate-properties-results" data-mode="html">
<?php echo opalestate_load_template_path( 'shortcodes/ajax-map-search-result', $display ); ?>
<?php echo opalestate_load_template_path( 'shortcodes/ajax-map-search-result' , $display ); ?>
</div> </div>

View File

@ -35,16 +35,19 @@ $show = ( isset( $_GET['display'] ) && $_GET['display'] == 'list' ) || ( opalest
<?php if ( $query->have_posts() ): ?> <?php if ( $query->have_posts() ): ?>
<div class="<?php echo apply_filters( 'opalestate_row_container_class', 'opal-row' ); ?>"> <div class="<?php echo apply_filters( 'opalestate_row_container_class', 'opal-row' ); ?>">
<?php if ( $show == 'list' ): ?> <?php if ( $show == 'list' ): ?>
<?php
$style_list = isset( $style_list ) && $style_list ? 'content-property-' . $style_list : $list_layout;
?>
<?php $cnt = 0; <?php $cnt = 0;
while ( $query->have_posts() ) : $query->the_post(); ?> while ( $query->have_posts() ) : $query->the_post(); ?>
<div class="col-lg-12 col-md-12 col-sm-12" data-related="map" data-id="<?php echo $cnt++; ?>"> <div class="col-lg-12 col-md-12 col-sm-12" data-related="map" data-id="<?php echo $cnt++; ?>">
<?php echo opalestate_load_template_path( $list_layout ); ?> <?php echo opalestate_load_template_path( $style_list ); ?>
</div> </div>
<?php endwhile; ?> <?php endwhile; ?>
<?php else : ?> <?php else : ?>
<?php <?php
$column = isset( $column ) ? $column : apply_filters( 'opalestate_properties_column_row', 3 ); $column = isset( $column ) ? $column : apply_filters( 'opalestate_properties_column_row', 3 );
$layout = isset( $style ) ? 'content-property-' . $style : $grid_layout; $layout = isset( $style ) && $style ? 'content-property-' . $style : $grid_layout;
$clscol = floor( 12 / $column ); $clscol = floor( 12 / $column );
$cnt = 0; $cnt = 0;
while ( $query->have_posts() ) : $query->the_post(); while ( $query->have_posts() ) : $query->the_post();