diff --git a/changelog.txt b/changelog.txt
index 65c9c559..38bb70e4 100755
--- a/changelog.txt
+++ b/changelog.txt
@@ -1,3 +1,7 @@
+= 1.6 - 2020-06-25 =
+* Added - Related properties setting
+* Added - Nearby properties setting
+
= 1.5.9 - 2020-06-22 =
* Added - Currency
* Fixes - Subscriber admin bar
diff --git a/inc/admin/settings/property.php b/inc/admin/settings/property.php
index d25c93db..1778395b 100755
--- a/inc/admin/settings/property.php
+++ b/inc/admin/settings/property.php
@@ -366,19 +366,21 @@ class Opalestate_Settings_Property_Tab extends Opalestate_Settings_Base_Tab {
$fields = [];
$fields[] = [
- 'name' => esc_html__( 'Single Layout Page', 'opalestate-pro' ),
- 'desc' => esc_html__( 'Choose layout for single property.', 'opalestate-pro' ),
- 'id' => 'layout',
- 'type' => 'select',
- 'options' => apply_filters( 'opalestate_single_layout_templates', [ '' => esc_html__( 'Inherit', 'opalestate-pro' ) ] ),
+ 'name' => esc_html__( 'Single Layout Page', 'opalestate-pro' ),
+ 'desc' => esc_html__( 'Choose layout for single property.', 'opalestate-pro' ),
+ 'id' => 'layout',
+ 'type' => 'select',
+ 'options' => apply_filters( 'opalestate_single_layout_templates', [ '' => esc_html__( 'Inherit', 'opalestate-pro' ) ] ),
+ 'after_row' => '
',
];
$fields[] = [
- 'name' => esc_html__( 'Single Preview Display', 'opalestate-pro' ),
- 'desc' => esc_html__( 'Choose preview layout for single property.', 'opalestate-pro' ),
- 'id' => 'single_preview',
- 'type' => 'select',
- 'options' => opalestate_single_layout_preview(),
+ 'name' => esc_html__( 'Single Preview Display', 'opalestate-pro' ),
+ 'desc' => esc_html__( 'Choose preview layout for single property.', 'opalestate-pro' ),
+ 'id' => 'single_preview',
+ 'type' => 'select',
+ 'options' => opalestate_single_layout_preview(),
+ 'after_row' => '
',
];
$fields[] = [
@@ -611,21 +613,88 @@ class Opalestate_Settings_Property_Tab extends Opalestate_Settings_Base_Tab {
];
$fields[] = [
- 'name' => esc_html__( 'Related properties layout', 'opalestate-pro' ),
- 'desc' => esc_html__( 'Select a layout for related properties.', 'opalestate-pro' ),
- 'id' => 'single_related_properties_layout',
- 'type' => 'select',
- 'options' => opalestate_get_loop_property_layouts(),
- 'after_row' => '
',
+ 'name' => esc_html__( 'Show Related properties', 'opalestate-pro' ),
+ 'desc' => esc_html__( 'Show Related properties the single property page.', 'opalestate-pro' ),
+ 'id' => 'enable_single_related_properties',
+ 'type' => 'switch',
+ 'options' => [
+ 'on' => esc_html__( 'Enable', 'opalestate-pro' ),
+ 'off' => esc_html__( 'Disable', 'opalestate-pro' ),
+ ],
+ 'default' => 'on',
];
$fields[] = [
- 'name' => esc_html__( 'Nearby properties layout', 'opalestate-pro' ),
- 'desc' => esc_html__( 'Select a layout for nearby properties.', 'opalestate-pro' ),
- 'id' => 'single_nearby_properties_layout',
- 'type' => 'select',
- 'options' => opalestate_get_loop_property_layouts(),
- 'after_row' => '
',
+ 'name' => esc_html__( 'Related properties layout', 'opalestate-pro' ),
+ 'desc' => esc_html__( 'Select a layout for related properties.', 'opalestate-pro' ),
+ 'id' => 'single_related_properties_layout',
+ 'type' => 'select',
+ 'options' => opalestate_get_loop_property_layouts(),
+ ];
+
+ $fields[] = [
+ 'name' => esc_html__( 'Number of properties', 'opalestate-pro' ),
+ 'id' => 'single_related_number',
+ 'type' => 'text_small',
+ 'attributes' => [
+ 'type' => 'number',
+ 'min' => 1,
+ ],
+ 'default' => 6,
+ 'after_row' => '
',
+ ];
+
+ $fields[] = [
+ 'name' => esc_html__( 'Show Nearby properties', 'opalestate-pro' ),
+ 'desc' => esc_html__( 'Show Nearby properties in the single property page.', 'opalestate-pro' ),
+ 'id' => 'enable_single_nearby_properties',
+ 'type' => 'switch',
+ 'options' => [
+ 'on' => esc_html__( 'Enable', 'opalestate-pro' ),
+ 'off' => esc_html__( 'Disable', 'opalestate-pro' ),
+ ],
+ 'default' => 'on',
+ ];
+
+ $fields[] = [
+ 'name' => esc_html__( 'Nearby properties layout', 'opalestate-pro' ),
+ 'desc' => esc_html__( 'Select a layout for nearby properties.', 'opalestate-pro' ),
+ 'id' => 'single_nearby_properties_layout',
+ 'type' => 'select',
+ 'options' => opalestate_get_loop_property_layouts(),
+ ];
+
+ $fields[] = [
+ 'name' => esc_html__( 'Nearby Radius', 'opalestate-pro' ),
+ 'id' => 'single_nearby_radius',
+ 'type' => 'text_small',
+ 'attributes' => [
+ 'type' => 'number',
+ 'min' => 1,
+ ],
+ 'default' => 5,
+ ];
+
+ $fields[] = [
+ 'name' => esc_html__( 'Nearby Measure Unit', 'opalestate-pro' ),
+ 'id' => 'single_nearby_measure_unit',
+ 'type' => 'select',
+ 'options' => [
+ 'km' => esc_html__( 'km', 'opalestate-pro' ),
+ 'miles' => esc_html__( 'miles', 'opalestate-pro' ),
+ ],
+ ];
+
+ $fields[] = [
+ 'name' => esc_html__( 'Number of properties', 'opalestate-pro' ),
+ 'id' => 'single_nearby_number',
+ 'type' => 'text_small',
+ 'attributes' => [
+ 'type' => 'number',
+ 'min' => 1,
+ ],
+ 'default' => 6,
+ 'after_row' => '
',
];
return $fields;
diff --git a/inc/api/v1/property.php b/inc/api/v1/property.php
index a3b5a52c..d70d43d9 100644
--- a/inc/api/v1/property.php
+++ b/inc/api/v1/property.php
@@ -494,7 +494,7 @@ class Opalestate_Property_Api extends Opalestate_Base_API {
} elseif ( $request['geo_lat'] && $request['geo_long'] ) {
$radius_measure = isset( $request['radius_measure'] ) ? sanitize_text_field( $request['radius_measure'] ) : 'km';
$radius = isset( $request['geo_radius'] ) ? sanitize_text_field( $request['geo_radius'] ) : 10;
- $post_ids = Opalestate_Query::filter_by_location( sanitize_text_field( $request['geo_lat'] ), sanitize_text_field( $request['geo_long'] ), $radius_measure, $radius );
+ $post_ids = Opalestate_Query::filter_by_location( sanitize_text_field( $request['geo_lat'] ), sanitize_text_field( $request['geo_long'] ), $radius, $radius_measure );
$args['post__in'] = $post_ids;
}
}
diff --git a/inc/property/class-opalestate-search.php b/inc/property/class-opalestate-search.php
index 22bcda9a..689396c4 100755
--- a/inc/property/class-opalestate-search.php
+++ b/inc/property/class-opalestate-search.php
@@ -291,7 +291,7 @@ class OpalEstate_Search {
} elseif ( $_GET['geo_lat'] && $_GET['geo_long'] ) {
$radius_measure = isset( $_GET['radius_measure'] ) ? sanitize_text_field( $_GET['radius_measure'] ) : 'km';
$radius = isset( $_GET['geo_radius'] ) ? sanitize_text_field( $_GET['geo_radius'] ) : 10;
- $post_ids = Opalestate_Query::filter_by_location( sanitize_text_field( $_GET['geo_lat'] ), sanitize_text_field( $_GET['geo_long'] ), $radius_measure, $radius );
+ $post_ids = Opalestate_Query::filter_by_location( sanitize_text_field( $_GET['geo_lat'] ), sanitize_text_field( $_GET['geo_long'] ), $radius, $radius_measure );
$args['post__in'] = $post_ids;
}
}
diff --git a/inc/template-functions.php b/inc/template-functions.php
index 0619bf2a..0318de2f 100755
--- a/inc/template-functions.php
+++ b/inc/template-functions.php
@@ -787,8 +787,11 @@ function opalestate_get_property_walkscore_score( $property ) {
* Gets related properties template.
*/
function opalestate_properties_related() {
+ if ( 'on' !== opalestate_get_option( 'enable_single_related_properties', 'on' ) ) {
+ return;
+ }
- $num = apply_filters( 'opalestate_related_properties_number', 6 );
+ $num = opalestate_get_option( 'single_related_number', 6 );
$args = [
'post_type' => 'opalestate_property',
'posts_per_page' => $num,
@@ -819,7 +822,6 @@ function opalestate_properties_related() {
];
}
-
if ( $tax_query ) {
$args['tax_query'] = [ 'relation' => 'AND' ];
$args['tax_query'] = array_merge( $args['tax_query'], $tax_query );
@@ -840,10 +842,14 @@ function opalestate_properties_related() {
* Gets nearby properties template.
*/
function opalestate_properties_nearby() {
+ if ( 'on' !== opalestate_get_option( 'enable_single_nearby_properties', 'on' ) ) {
+ return;
+ }
+
global $property;
$maps = $property->get_map();
- $num = apply_filters( 'opalestate_nearby_properties_number', 6 );
+ $num = opalestate_get_option( 'single_nearby_number', 6 );
$post_id = get_the_ID();
$args = [
@@ -858,8 +864,9 @@ function opalestate_properties_nearby() {
return;
}
- $radius = 5;
- $post_ids = Opalestate_Query::filter_by_location( $geo_lat, $geo_long, 'km', $radius );
+ $radius = opalestate_get_option( 'single_nearby_radius', 5 );
+ $measure_unit = opalestate_get_option( 'single_nearby_measure_unit', 'km' );
+ $post_ids = Opalestate_Query::filter_by_location( $geo_lat, $geo_long, $radius, $measure_unit );
if ( empty( $post_ids ) ) {
return;
diff --git a/inc/user/class-opalestate-user.php b/inc/user/class-opalestate-user.php
index 8146702b..e0f961b0 100755
--- a/inc/user/class-opalestate-user.php
+++ b/inc/user/class-opalestate-user.php
@@ -178,7 +178,7 @@ class OpalEstate_User {
return false;
}
- if ( in_array( 'subscriber', $roles ) && opalestate_is_user_management_page() ) {
+ if ( in_array( 'subscriber', $roles ) ) {
return false;
}
}
diff --git a/opal-estate-pro.php b/opal-estate-pro.php
index 8969772c..2da4cc4f 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.5.9
+ * Version: 1.6
* Author: WPOPAL
* Author URI: http://www.wpopal.com
* Requires at least: 4.9
@@ -154,7 +154,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.5.9' );
+ _doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ huh?', 'opalestate-pro' ), '1.6' );
}
/**
@@ -163,7 +163,7 @@ if ( ! class_exists( 'OpalEstate' ) ) {
public function setup_constants() {
// Plugin version
if ( ! defined( 'OPALESTATE_VERSION' ) ) {
- define( 'OPALESTATE_VERSION', '1.5.9' );
+ define( 'OPALESTATE_VERSION', '1.6' );
}
// Plugin Folder Path
diff --git a/readme.txt b/readme.txt
index 429863f2..c0835506 100755
--- a/readme.txt
+++ b/readme.txt
@@ -150,6 +150,10 @@ This section describes how to install the plugin and get it working.
* System tickets support 24/7 available : [free support](https://themelexus.ticksy.com/ "Visit the Plugin support Page")
== Changelog ==
+= 1.6 - 2020-06-25 =
+* Added - Related properties setting
+* Added - Nearby properties setting
+
= 1.5.9 - 2020-06-22 =
* Added - Currency
* Fixes - Subscriber admin bar