Add single settings.
This commit is contained in:
parent
b2f43caeb1
commit
0eae5ced4d
@ -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' ),
|
||||
|
@ -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';
|
||||
|
@ -146,6 +146,9 @@ class Opalestate_Property {
|
||||
'apartments',
|
||||
'floor_plans',
|
||||
'views_statistics',
|
||||
'author_box',
|
||||
'enquire_form',
|
||||
'mortgage',
|
||||
];
|
||||
|
||||
foreach ( $keys as $key ) {
|
||||
|
@ -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 ) {
|
||||
</a>';
|
||||
}
|
||||
|
||||
///
|
||||
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' );
|
||||
|
@ -1,6 +1,10 @@
|
||||
<?php
|
||||
global $post;
|
||||
|
||||
if ( ! opalestate_get_option( 'enable_single_enquire_form' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$message = sprintf( __( 'Hi, I am interested in %s (Property ID: %s)', 'opalestate-pro' ), get_the_title(), get_the_ID() );
|
||||
|
||||
$property_id = get_the_ID();
|
||||
@ -24,7 +28,7 @@ $id = 'send-enquiry-form';
|
||||
name="contact-form"><?php echo esc_html__( 'Send message', 'opalestate-pro' ); ?></button>
|
||||
</form>
|
||||
<?php else : ?>
|
||||
<div class="opalestate-box-content property-equire-form">
|
||||
<div class="opalestate-box-content property-enquire-form">
|
||||
<div class="opalestate-box">
|
||||
<div class="property-equire-form-container">
|
||||
<h5 class="contact-form-title"><?php echo $heading; ?></h5>
|
||||
|
@ -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 = '';
|
||||
|
@ -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;
|
||||
}
|
||||
?>
|
||||
<div class="opalestate-box-content property-agent-section">
|
||||
<div class="opalestate-box">
|
||||
<div class="author-content-box">
|
||||
<div class="property-agent-info">
|
||||
<?php echo wp_kses_post( $author_info ); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo opalestate_load_template_path( 'messages/enquiry-form' , array('nowrap' => true) ); ?>
|
||||
</div>
|
||||
<div class="opalestate-box">
|
||||
<?php if ( opalestate_get_option( 'enable_single_author_box' ) ) : ?>
|
||||
<div class="author-content-box">
|
||||
<div class="property-agent-info">
|
||||
<?php echo wp_kses_post( $author_info ); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( opalestate_get_option( 'enable_single_enquire_form' ) ) : ?>
|
||||
<?php echo opalestate_load_template_path( 'messages/enquiry-form', [ 'nowrap' => true ] ); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -46,14 +46,19 @@ switch ( $type ) {
|
||||
<div class="opalestate-box">
|
||||
<div class="author-content-box">
|
||||
<div class="opal-row">
|
||||
<div class="col-lg-6 col-md-6">
|
||||
<div class="property-agent-info">
|
||||
<?php echo wp_kses_post( $author_info ); ?>
|
||||
<?php if ( opalestate_get_option( 'enable_single_author_box' ) ) : ?>
|
||||
<div class="col-lg-6 col-md-6">
|
||||
<div class="property-agent-info">
|
||||
<?php echo wp_kses_post( $author_info ); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6">
|
||||
<?php echo opalestate_load_template_path( 'messages/enquiry-form', [ 'nowrap' => true ] ); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( opalestate_get_option( 'enable_single_enquire_form' ) ) : ?>
|
||||
<div class="col-lg-6 col-md-6">
|
||||
<?php echo opalestate_load_template_path( 'messages/enquiry-form', [ 'nowrap' => true ] ); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user