This commit is contained in:
ThemeLexus 2019-09-30 10:37:36 +07:00
parent b2b82e2d4a
commit 76759b11e3
2 changed files with 59 additions and 13 deletions

View File

@ -67,19 +67,48 @@ class OpalEstate_Shortcodes {
*/
public function search_properties_form ( $atts=[] ) {
$atts = is_array( $atts ) ? $atts : [];
$atts = is_array( $atts ) ? $atts : [];
$layout = 'collapse-advanced';
$atts['hidden_labels'] = true;
$default = array(
'hidden_labels' => true,
'display_more_options' => true,
'nobutton' => false,
'layout' => $layout
);
return opalestate_load_template_path( 'search-box/collapse-advanced', $atts );
$atts = array_merge( $default, $atts );
return opalestate_load_template_path( 'search-box/'.$layout, $atts );
}
public function properties() {
return opalestate_load_template_path( 'shortcodes/properties' );
/**
* Display all properties follow user when logined
*/
public function properties( $atts=[] ) {
$atts = is_array( $atts ) ? $atts : [];
$default = array (
'posts_per_page' => 10,
'show_pagination' => true,
'column' => apply_filters( 'opalestate_properties_column_row', 3 ),
'layout' => 'content-property-grid-v2'
);
$atts = array_merge( $default, $atts );
return opalestate_load_template_path( 'shortcodes/properties', $atts );
}
public function search_properties_result() {
return opalestate_load_template_path( 'shortcodes/search-properties-result' );
/**
* [opalestate_search_properties_result] Display all properties follow user when logined
*/
public function search_properties_result( $atts=[] ) {
$atts = is_array( $atts ) ? $atts : [];
return opalestate_load_template_path( 'shortcodes/search-properties-result', $atts );
}
/**

View File

@ -1,22 +1,39 @@
<?php
$args = [
'posts_per_page' => -1,
'posts_per_page' => $posts_per_page,
];
$query = Opalestate_Query::get_property_query( $args );
$class = 'column-item';
$clscol = floor( 12 / $column );
?>
<div class="opalesate-property-collection">
<?php if ( $query->have_posts() ): ?>
<?php while ( $query->have_posts() ) : $query->the_post(); ?>
<div class="column-item">
<?php echo opalestate_load_template_path( 'content-property-grid-v2' ); ?>
</div>
<?php endwhile; ?>
<div class="opal-row">
<?php $cnt=0; while ( $query->have_posts() ) : $query->the_post(); ?>
<?php
$cls = '';
if ( $cnt++ % $column == 0 ) {
$cls .= ' first-child';
}
?>
<div class="<?php echo $cls; ?> col-lg-<?php echo esc_attr( $clscol ); ?> col-md-<?php echo esc_attr( $clscol ); ?> col-sm-6" data-related="map" data-id="<?php echo
esc_attr( $cnt - 1 );
?>">
<?php echo opalestate_load_template_path( $layout ); ?>
</div>
<?php endwhile; ?>
</div>
<?php if ( $query->max_num_pages > 1 && $show_pagination ): ?>
<div class="w-pagination"><?php opalestate_pagination( $query->max_num_pages ); ?></div>
<?php endif; ?>
<?php else: ?>
<?php echo opalestate_load_template_path( 'content-no-results' ); ?>
<?php endif; ?>