Add display mode setting

This commit is contained in:
Hoang Huu
2020-03-03 10:57:04 +07:00
parent e5991913ed
commit dc14e74e6d
11 changed files with 77 additions and 53 deletions

View File

@@ -26,7 +26,7 @@ $grid_layout = 'content-property-' . opalestate_get_option( 'property_archive_gr
<div class="opalesate-archive-bottom opalestate-rows opalestate-collection">
<div class="opal-row">
<?php if ( ( isset( $_GET['display'] ) && $_GET['display'] == 'list' ) || opalestate_get_display_mode( 'list' ) == 'list' ) : ?>
<?php if ( ( isset( $_GET['display'] ) && $_GET['display'] == 'list' ) || opalestate_get_display_mode( opalestate_options( 'displaymode', 'grid' ) ) == 'list' ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
<div class="col-lg-12 col-md-12 col-sm-12">
<?php echo opalestate_load_template_path( $list_layout ); ?>

View File

@@ -14,4 +14,4 @@
</div>
<?php opalestate_show_display_modes(); ?>
</div>
</div></div>
</div></div>

View File

@@ -1,29 +1,19 @@
<?php
$selected = '';
$mode = isset($mode)?$mode:'';
<?php
$selected = '';
?>
<div class="opalesate-archive-top">
<div class="<?php echo apply_filters('opalestate_row_container_class', 'opal-row');?>">
<div class="col-lg-8 col-md-7 col-sm-6">
<?php opalestate_show_display_status();
?>
</div>
<div class="<?php echo apply_filters( 'opalestate_row_container_class', 'opal-row' ); ?>">
<div class="col-lg-8 col-md-7 col-sm-6">
<?php opalestate_show_display_status(); ?>
</div>
<div class="col-lg-4 col-md-5 col-sm-6 space-margin-top-10p">
<div class="opalestate-sortable pull-right">
<div class="col-lg-4 col-md-5 col-sm-6 space-margin-top-10p">
<div class="opalestate-sortable pull-right">
<?php echo opalestate_render_sortable_dropdown( $selected ); ?>
</div>
<div class="pull-right">
<?php opalestate_show_display_modes( $mode ); ?>
</div>
</div>
</div>
</div>
<div class="pull-right">
<?php opalestate_show_display_modes(); ?>
</div>
</div>
</div>
</div>

View File

@@ -7,8 +7,11 @@ if ( ! class_exists( 'OpalEstate_Search' ) ) {
}
$query = OpalEstate_Search::get_search_results_query();
$show = opalestate_options( 'displaymode', 'grid' );
$show = ( isset( $_GET['display'] ) && $_GET['display'] == 'list' ) || ( opalestate_options( 'displaymode', 'grid' ) == 'list' ) || ( isset( $style ) && $style == 'list' ) ? 'list' : 'grid';
if ( isset( $_GET['display'] ) && $_GET['display'] && in_array( sanitize_text_field( $_GET['display'] ), [ 'grid', 'list' ] ) ) {
$show = sanitize_text_field( $_GET['display'] );
}
?>
<div class="opaleslate-ajax-search-results-container">
<div class="opalesate-archive-top">
@@ -26,7 +29,7 @@ $show = ( isset( $_GET['display'] ) && $_GET['display'] == 'list' ) || ( opalest
<div class="opalestate-sortable">
<?php echo opalestate_render_sortable_dropdown(); ?>
</div>
<?php opalestate_show_display_modes( 'grid' ); ?>
<?php opalestate_show_display_modes(); ?>
</div>
</div>
</div>