diff --git a/inc/admin/settings/property.php b/inc/admin/settings/property.php index 17443ad9..9954d355 100755 --- a/inc/admin/settings/property.php +++ b/inc/admin/settings/property.php @@ -425,6 +425,39 @@ class Opalestate_Settings_Property_Tab extends Opalestate_Settings_Base_Tab { 'default' => 8, ]; + $fields[] = [ + 'name' => esc_html__( 'Show Author box', 'opalestate-pro' ), + 'desc' => esc_html__( 'Show Author box in the single property page.', 'opalestate-pro' ), + 'id' => 'enable_single_author_box', + 'type' => 'switch', + 'options' => [ + 'on' => esc_html__( 'Enable', 'opalestate-pro' ), + 'off' => esc_html__( 'Disable', 'opalestate-pro' ), + ], + ]; + + $fields[] = [ + 'name' => esc_html__( 'Show Enquire form', 'opalestate-pro' ), + 'desc' => esc_html__( 'Show Enquire form in the single property page.', 'opalestate-pro' ), + 'id' => 'enable_single_enquire_form', + 'type' => 'switch', + 'options' => [ + 'on' => esc_html__( 'Enable', 'opalestate-pro' ), + 'off' => esc_html__( 'Disable', 'opalestate-pro' ), + ], + ]; + + $fields[] = [ + 'name' => esc_html__( 'Show Mortgage Calculator', 'opalestate-pro' ), + 'desc' => esc_html__( 'Show Mortgage Calculator in the single property page.', 'opalestate-pro' ), + 'id' => 'enable_single_mortgage', + 'type' => 'switch', + 'options' => [ + 'on' => esc_html__( 'Enable', 'opalestate-pro' ), + 'off' => esc_html__( 'Disable', 'opalestate-pro' ), + ], + ]; + $fields[] = [ 'name' => esc_html__( 'Related properties layout', 'opalestate-pro' ), 'desc' => esc_html__( 'Select a layout for related properties.', 'opalestate-pro' ), diff --git a/inc/class-opalestate-install.php b/inc/class-opalestate-install.php index a55ea43f..2e221872 100755 --- a/inc/class-opalestate-install.php +++ b/inc/class-opalestate-install.php @@ -120,6 +120,9 @@ class Opalestate_Install { $options['enable_single_floor_plans'] = 'on'; $options['enable_single_views_statistics'] = 'on'; $options['single_views_statistics_limit'] = 8; + $options['enable_single_author_box'] = 'on'; + $options['enable_single_enquire_form'] = 'on'; + $options['enable_single_mortgage'] = 'on'; $options['enable_property_reviews'] = 'on'; $options['enable_agency_reviews'] = 'on'; diff --git a/inc/property/class-opalestate-property.php b/inc/property/class-opalestate-property.php index a3742d81..09a01b69 100755 --- a/inc/property/class-opalestate-property.php +++ b/inc/property/class-opalestate-property.php @@ -146,6 +146,9 @@ class Opalestate_Property { 'apartments', 'floor_plans', 'views_statistics', + 'author_box', + 'enquire_form', + 'mortgage', ]; foreach ( $keys as $key ) { diff --git a/inc/template-hook-functions.php b/inc/template-hook-functions.php index 95816aa9..446684dc 100755 --- a/inc/template-hook-functions.php +++ b/inc/template-hook-functions.php @@ -36,8 +36,9 @@ function opalestate_single_property_layout_default() { add_action( 'opalestate_single_property_sidebar', 'opalestate_property_equiry_form', 6 ); // add_action( 'opalestate_single_property_sidebar', 'opalestate_property_request_viewing_button', 7 ); - add_action( 'opalestate_single_property_sidebar', 'opalestate_property_mortgage', 9 ); - + if ( opalestate_get_option( 'enable_single_mortgage' ) ) { + add_action( 'opalestate_single_property_sidebar', 'opalestate_property_mortgage', 9 ); + } add_filter( 'opalestate_thumbnail_nav_column', function () { return 6; @@ -74,8 +75,10 @@ function opalestate_single_property_layout_v2() { /// /// sidebar //////// + if ( opalestate_get_option( 'enable_single_mortgage' ) ) { + add_action( 'opalestate_single_property_sidebar', 'opalestate_property_mortgage', 9 ); + } - add_action( 'opalestate_single_property_sidebar', 'opalestate_property_mortgage', 9 ); add_action( 'opalestate_single_property_sidebar', 'opalestate_property_author_v3', 10 ); // add_action( 'opalestate_single_property_sidebar', 'opalestate_property_equiry_form' , 12 ); } @@ -109,9 +112,10 @@ function opalestate_single_property_layout_v3() { add_action( 'opalestate_single_property_sidebar', 'opalestate_property_author_v2', 5 ); add_action( 'opalestate_single_property_sidebar', 'opalestate_property_equiry_form', 6 ); - /// - add_action( 'opalestate_single_property_sidebar', 'opalestate_property_mortgage' ); + if ( opalestate_get_option( 'enable_single_mortgage' ) ) { + add_action( 'opalestate_single_property_sidebar', 'opalestate_property_mortgage' ); + } } /** @@ -142,8 +146,10 @@ function opalestate_single_property_layout_v4() { add_action( 'opalestate_single_property_sidebar', 'opalestate_property_author_v2', 5 ); add_action( 'opalestate_single_property_sidebar', 'opalestate_property_equiry_form', 6 ); - /// - add_action( 'opalestate_single_property_sidebar', 'opalestate_property_mortgage', 9 ); + + if ( opalestate_get_option( 'enable_single_mortgage' ) ) { + add_action( 'opalestate_single_property_sidebar', 'opalestate_property_mortgage', 9 ); + } } /** @@ -169,12 +175,10 @@ function opalestate_single_property_layout_v5() { add_action( 'opalestate_after_single_property_summary', 'opalestate_property_views_statistics', 50 ); - // add_action( 'opalestate_after_single_property_summary', 'opalestate_property_author', 55 ); add_action( 'opalestate_after_single_property_summary', 'opalestate_property_tags', 60 ); add_action( 'opalestate_after_single_property_summary', 'comments_template', 65 ); add_action( 'opalestate_after_single_property_summary_v2', 'opalestate_property_map_v2', 5 ); - add_filter( 'opalestate_thumbnail_nav_column', function () { return 10; } ); @@ -182,9 +186,9 @@ function opalestate_single_property_layout_v5() { add_action( 'opalestate_single_property_sidebar', 'opalestate_property_author_v2', 5 ); add_action( 'opalestate_single_property_sidebar', 'opalestate_property_equiry_form', 6 ); - // add_action( 'opalestate_single_property_sidebar', 'opalestate_property_request_viewing_button', 7 ); - - add_action( 'opalestate_single_property_sidebar', 'opalestate_property_mortgage', 9 ); + if ( opalestate_get_option( 'enable_single_mortgage' ) ) { + add_action( 'opalestate_single_property_sidebar', 'opalestate_property_mortgage', 9 ); + } } @@ -203,8 +207,9 @@ function opalestate_property_request_viewing_button( $islink = false ) { '; } -/// -add_action( 'opalestate_single_property_layout', 'opalestate_single_property_layout' ); +/** + * @param $layout + */ function opalestate_single_property_layout( $layout ) { switch ( $layout ) { case 'v2': @@ -224,7 +229,7 @@ function opalestate_single_property_layout( $layout ) { break; } } - +add_action( 'opalestate_single_property_layout', 'opalestate_single_property_layout' ); /** * Forms @@ -264,12 +269,10 @@ if ( ! function_exists( "opalestate_login_register_form_popup" ) ) { } add_action( 'wp_footer', 'opalestate_login_register_form_popup', 9 ); - /** * Add "Custom" template to page attirbute template section. */ function opalestate_add_template_to_select( $post_templates, $wp_theme, $post, $post_type ) { - // Add custom template named template-custom.php to select dropdown $post_templates['user-management.php'] = esc_html__( 'User Management', 'opalestate-pro' ); $post_templates['fullwidth-page.php'] = esc_html__( 'Opalestate Fullwidth', 'opalestate-pro' ); @@ -298,13 +301,12 @@ function opalestate_load_plugin_template( $template ) { } if ( $template == '' ) { - throw new \Exception( 'No template found' ); + throw new Exception( 'No template found' ); } return $template; } add_filter( 'template_include', 'opalestate_load_plugin_template' ); - add_action( 'opalestate_before_property_loop_item', 'opalestate_property_featured_label' ); add_action( 'opalestate_before_property_loop_item', 'opalestate_property_label' ); diff --git a/templates/messages/enquiry-form.php b/templates/messages/enquiry-form.php index ed94ee91..69f3799d 100755 --- a/templates/messages/enquiry-form.php +++ b/templates/messages/enquiry-form.php @@ -1,6 +1,10 @@ -
+
diff --git a/templates/single-property/author-v2.php b/templates/single-property/author-v2.php index 39b26974..5fe57932 100755 --- a/templates/single-property/author-v2.php +++ b/templates/single-property/author-v2.php @@ -2,8 +2,13 @@ if ( ! defined( 'ABSPATH' ) ) { exit; } + global $post, $property; +if ( ! opalestate_get_option( 'enable_single_author_box' ) ) { + return; +} + $type = $property->get_author_type(); $data = get_userdata( $post->post_author ); $layout = ''; diff --git a/templates/single-property/author-v3.php b/templates/single-property/author-v3.php index 18392991..90e563f8 100755 --- a/templates/single-property/author-v3.php +++ b/templates/single-property/author-v3.php @@ -4,47 +4,56 @@ if ( ! defined( 'ABSPATH' ) ) { } global $post, $property; -$type = $property->get_author_type(); -$data = get_userdata( $post->post_author ); +$type = $property->get_author_type(); +$data = get_userdata( $post->post_author ); $layout = 'list'; switch ( $type ) { - case 'hide': - return ; - break; - case 'agent' : - $agent_id = $property->get_metabox_value( 'agent' ); - - $author_info = opalestate_load_template_path( 'single-property/user/author-member-box', - array( 'author' => $data, - 'id' => $agent_id , - 'prefix' => OPALESTATE_AGENT_PREFIX, - 'picture' => '', - 'type' => 'agent', - 'hide_description' => true ) ); - break; - case 'agency' : - $agency_id = $property->get_metabox_value( 'agency' ); - $author_info = opalestate_load_template_path( 'single-property/user/author-member-box', - array( 'author' => $data, - 'id' => $agency_id , - 'picture' => '', - 'type' => 'agency', - 'hide_description' => true ) ); - break; - default: - - $author_info = opalestate_load_template_path( 'single-property/user/author-user-box', array('author' => $data , 'hide_description' => true ), $layout ); - - break; -} + case 'hide': + return; + break; + case 'agent' : + $agent_id = $property->get_metabox_value( 'agent' ); + + $author_info = opalestate_load_template_path( 'single-property/user/author-member-box', + [ + 'author' => $data, + 'id' => $agent_id, + 'prefix' => OPALESTATE_AGENT_PREFIX, + 'picture' => '', + 'type' => 'agent', + 'hide_description' => true, + ] ); + break; + case 'agency' : + $agency_id = $property->get_metabox_value( 'agency' ); + $author_info = opalestate_load_template_path( 'single-property/user/author-member-box', + [ + 'author' => $data, + 'id' => $agency_id, + 'picture' => '', + 'type' => 'agency', + 'hide_description' => true, + ] ); + break; + default: + + $author_info = opalestate_load_template_path( 'single-property/user/author-user-box', [ 'author' => $data, 'hide_description' => true ], $layout ); + + break; +} ?>
-
-
-
- -
-
- true) ); ?> -
+
+ +
+
+ +
+
+ + + + true ] ); ?> + +
diff --git a/templates/single-property/author.php b/templates/single-property/author.php index 7555ecf0..f73f9b00 100755 --- a/templates/single-property/author.php +++ b/templates/single-property/author.php @@ -46,14 +46,19 @@ switch ( $type ) {
-
-
- + +
+
+ +
-
-
- true ] ); ?> -
+ + + +
+ true ] ); ?> +
+