From 76302994156f640c80bdd6ae84f34eda121b3481 Mon Sep 17 00:00:00 2001 From: Hoang Huu Date: Thu, 26 Sep 2019 15:43:47 +0700 Subject: [PATCH] Add hide virtual tour setting. --- inc/admin/settings/property.php | 11 +++++++++++ inc/property/class-opalestate-property.php | 1 + templates/single-property/information.php | 8 ++++++-- templates/single-property/video.php | 11 +++++++---- templates/single-property/virtualtour.php | 17 ++++++++++++----- 5 files changed, 37 insertions(+), 11 deletions(-) diff --git a/inc/admin/settings/property.php b/inc/admin/settings/property.php index 9954d355..6568d919 100755 --- a/inc/admin/settings/property.php +++ b/inc/admin/settings/property.php @@ -346,6 +346,17 @@ class Opalestate_Settings_Property_Tab extends Opalestate_Settings_Base_Tab { ], ]; + $fields[] = [ + 'name' => esc_html__( 'Show Virtual Tour tab', 'opalestate-pro' ), + 'desc' => esc_html__( 'Show Virtual Tour tab in the single property page.', 'opalestate-pro' ), + 'id' => 'enable_single_virtual_tour', + 'type' => 'switch', + 'options' => [ + 'on' => esc_html__( 'Enable', 'opalestate-pro' ), + 'off' => esc_html__( 'Disable', 'opalestate-pro' ), + ], + ]; + $fields[] = [ 'name' => esc_html__( 'Show Map tab', 'opalestate-pro' ), 'desc' => esc_html__( 'Show Map tab in the single property page.', 'opalestate-pro' ), diff --git a/inc/property/class-opalestate-property.php b/inc/property/class-opalestate-property.php index 09a01b69..2afbf4f7 100755 --- a/inc/property/class-opalestate-property.php +++ b/inc/property/class-opalestate-property.php @@ -140,6 +140,7 @@ class Opalestate_Property { 'attachments', 'facilities', 'video', + 'virtual_tour', 'map', 'nearby', 'walkscores', diff --git a/templates/single-property/information.php b/templates/single-property/information.php index cacc6889..8237bc73 100755 --- a/templates/single-property/information.php +++ b/templates/single-property/information.php @@ -2,9 +2,13 @@ global $property; $infos = $property->get_meta_fullinfo(); -$taxs = $property->get_types_tax(); +$taxs = $property->get_types_tax(); +if ( ! $infos && ! $taxs ) { + return; +} ?> +
@@ -33,4 +37,4 @@ $taxs = $property->get_types_tax();
-
+ diff --git a/templates/single-property/video.php b/templates/single-property/video.php index ccf3a903..caa569ef 100755 --- a/templates/single-property/video.php +++ b/templates/single-property/video.php @@ -5,15 +5,18 @@ if ( ! $property->get_block_setting( 'video' ) ) { return; } -$videoURL = $property->get_video_url(); +$video_url = $property->get_video_url(); + +if ( ! $video_url ) { + return; +} ?> - +

- +
- diff --git a/templates/single-property/virtualtour.php b/templates/single-property/virtualtour.php index af49dc23..6bd7c199 100755 --- a/templates/single-property/virtualtour.php +++ b/templates/single-property/virtualtour.php @@ -1,15 +1,22 @@ get_virtual_tour(); +if ( ! $property->get_block_setting( 'virtual_tour' ) ) { + return; +} + +$virtual_tour = $property->get_virtual_tour(); + +if ( ! $virtual_tour ) { + return; +} ?> - +
-

+

- +
-