diff --git a/changelog.txt b/changelog.txt index 9082e135..efe32ff6 100755 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,6 @@ += 1.3.7 - 2020-03-03 = +* Added - Display mode setting + = 1.3.6 - 2020-02-29 = * Fixes - User register form & User roles diff --git a/inc/admin/settings/property.php b/inc/admin/settings/property.php index b55e8066..582044d1 100755 --- a/inc/admin/settings/property.php +++ b/inc/admin/settings/property.php @@ -85,6 +85,13 @@ class Opalestate_Settings_Property_Tab extends Opalestate_Settings_Base_Tab { 'options' => $checkes, ]; + $fields[] = [ + 'name' => esc_html__( 'Default Display mode', 'opalestate-pro' ), + 'id' => 'displaymode', + 'type' => 'select', + 'options' => opalestate_display_modes(), + ]; + $fields[] = [ 'name' => esc_html__( 'Archive Grid layout', 'opalestate-pro' ), 'id' => 'property_archive_grid_layout', diff --git a/inc/api/class-opalestate-admin-api-keys-table-list.php b/inc/api/class-opalestate-admin-api-keys-table-list.php index 05231b17..f162acc2 100644 --- a/inc/api/class-opalestate-admin-api-keys-table-list.php +++ b/inc/api/class-opalestate-admin-api-keys-table-list.php @@ -179,7 +179,7 @@ class Opalestate_Admin_API_Keys_Table_List extends WP_List_Table { public function column_last_access( $key ) { if ( ! empty( $key['last_access'] ) ) { /* translators: 1: last access date 2: last access time */ - $date = sprintf( __( '%1$s at %2$s', 'opalestate-pro' ), date_i18n( wc_date_format(), strtotime( $key['last_access'] ) ), + $date = sprintf( __( '%1$s at %2$s', 'opalestate-pro' ), date_i18n( get_option( 'date_format' ), strtotime( $key['last_access'] ) ), date_i18n( get_option( 'time_format' ), strtotime( $key['last_access'] ) ) ); return apply_filters( 'opalestate_api_key_last_access_datetime', $date, $key['last_access'] ); diff --git a/inc/mixes-functions.php b/inc/mixes-functions.php index 00165b4f..da9d4f3d 100755 --- a/inc/mixes-functions.php +++ b/inc/mixes-functions.php @@ -237,6 +237,18 @@ function opalestate_get_loop_property_layouts() { ] ); } +/** + * Gets display modes. + * + * @return array + */ +function opalestate_display_modes() { + return apply_filters( 'opalestate_display_modes', [ + 'grid' => esc_html__( 'Grid', 'opalestate-pro' ), + 'list' => esc_html__( 'List', 'opalestate-pro' ), + ] ); +} + /** * Gets loop property grid layouts. * diff --git a/inc/template-functions.php b/inc/template-functions.php index 58813378..99b994f7 100755 --- a/inc/template-functions.php +++ b/inc/template-functions.php @@ -13,7 +13,7 @@ if ( ! defined( 'ABSPATH' ) ) { /** * Add body classes for Opalestate pages. * - * @param array $classes Body Classes. + * @param array $classes Body Classes. * @return array */ function opalestate_body_class( $classes ) { @@ -25,13 +25,13 @@ function opalestate_body_class( $classes ) { $current_user = wp_get_current_user(); if ( $current_user ) { - $roles = $current_user->roles; - if ( $roles && is_array( $roles ) ) { - foreach ( $roles as $role ) { - $classes[] = 'opalestate-role-' . esc_attr( $role ); - } - } - } + $roles = $current_user->roles; + if ( $roles && is_array( $roles ) ) { + foreach ( $roles as $role ) { + $classes[] = 'opalestate-role-' . esc_attr( $role ); + } + } + } } return array_unique( $classes ); @@ -245,12 +245,12 @@ function opalestate_render_sortable_dropdown( $selected = '' ) { /** - * + * Display modes */ -function opalestate_show_display_modes( $default = 'list' ) { +function opalestate_show_display_modes( $default = '' ) { $op_display = opalestate_get_display_mode( $default ); - $modes = apply_filters( 'opalestate_listing_display_mode', [ + $modes = apply_filters( 'opalestate_listing_display_modes', [ 'grid' => [ 'icon' => 'fa fa-th', 'title' => esc_html__( 'Grid', 'opalestate-pro' ), @@ -259,20 +259,14 @@ function opalestate_show_display_modes( $default = 'list' ) { 'icon' => 'fa fa-th-list', 'title' => esc_html__( 'List', 'opalestate-pro' ), ], - /* 'map' => array( - 'icon' => 'fa fa-map-marker', - 'title' => esc_html__('Map','opalestate-pro') - ), */ ] ); - echo '
'; foreach ( $modes as $key => $mode ) { echo ''; } echo '
'; - } if ( ! function_exists( 'opalestate_pagination' ) ) { @@ -364,8 +358,15 @@ function opalestate_show_display_status() { get_map(); if ( ! $map || ! is_array( $map ) || ! isset( $map['latitude'] ) || ! isset( $map['longitude'] ) ) { - return false; - } + return false; + } $latitude = $map['latitude']; $longitude = $map['longitude']; diff --git a/opal-estate-pro.php b/opal-estate-pro.php index b562f1fd..98094da2 100755 --- a/opal-estate-pro.php +++ b/opal-estate-pro.php @@ -3,7 +3,7 @@ * Plugin Name: Opal Estate Pro * 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. - * Version: 1.3.6 + * Version: 1.3.7 * Author: WPOPAL * Author URI: http://www.wpopal.com * Requires at least: 4.9 @@ -150,7 +150,7 @@ if ( ! class_exists( 'OpalEstate' ) ) { */ public function __clone() { // Cloning instances of the class is forbidden - _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ huh?', 'opalestate-pro' ), '1.3.6' ); + _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ huh?', 'opalestate-pro' ), '1.3.7' ); } /** @@ -159,7 +159,7 @@ if ( ! class_exists( 'OpalEstate' ) ) { public function setup_constants() { // Plugin version if ( ! defined( 'OPALESTATE_VERSION' ) ) { - define( 'OPALESTATE_VERSION', '1.3.6' ); + define( 'OPALESTATE_VERSION', '1.3.7' ); } // Plugin Folder Path diff --git a/readme.txt b/readme.txt index 3b561339..dad276c3 100755 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Donate link: https://wpdocs.gitbook.io/opal-estate/ Tags: estate, property, opalestate, house for rent, agency for lease, estate submission, agents estate property, property marketplace Requires at least: 4.9 Tested up to: 5.3.2 -Stable tag: 1.3.6 +Stable tag: 1.3.7 License: GPLv3 License URI: http://www.gnu.org/licenses/gpl-3.0.html @@ -156,6 +156,9 @@ This section describes how to install the plugin and get it working. * System tickets support 24/7 available : [free support](https://wpopal.ticksy.com/ "Visit the Plugin support Page") == Changelog == += 1.3.7 - 2020-03-03 = +* Added - Display mode setting + = 1.3.6 - 2020-02-29 = * Fixes - User register form & User roles diff --git a/templates/archive-opalestate_property.php b/templates/archive-opalestate_property.php index 0bbf432b..15609316 100755 --- a/templates/archive-opalestate_property.php +++ b/templates/archive-opalestate_property.php @@ -26,7 +26,7 @@ $grid_layout = 'content-property-' . opalestate_get_option( 'property_archive_gr
- +
diff --git a/templates/parts/archive-simple-bars.php b/templates/parts/archive-simple-bars.php index b55a1204..72ecd819 100755 --- a/templates/parts/archive-simple-bars.php +++ b/templates/parts/archive-simple-bars.php @@ -14,4 +14,4 @@
-
\ No newline at end of file + diff --git a/templates/parts/collection-navigator.php b/templates/parts/collection-navigator.php index cd97465d..9fa7c7c3 100755 --- a/templates/parts/collection-navigator.php +++ b/templates/parts/collection-navigator.php @@ -1,29 +1,19 @@ -
-
-
- - - -
+
+
+ +
-
-
+
+
-
-
- -
-
-
+
+
+ +
+
+
diff --git a/templates/shortcodes/ajax-map-search-result.php b/templates/shortcodes/ajax-map-search-result.php index 0148404a..68cedd4b 100755 --- a/templates/shortcodes/ajax-map-search-result.php +++ b/templates/shortcodes/ajax-map-search-result.php @@ -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'] ); +} ?>
@@ -26,7 +29,7 @@ $show = ( isset( $_GET['display'] ) && $_GET['display'] == 'list' ) || ( opalest
- +