Add property settings
This commit is contained in:
@@ -226,6 +226,14 @@ class Opalestate_Settings_General_Tab extends Opalestate_Settings_Base_Tab {
|
||||
'options' => opalestate_get_measurement_units(),
|
||||
'default' => 'sqft',
|
||||
],
|
||||
[
|
||||
'name' => esc_html__( 'Time Format', 'opalestate-pro' ),
|
||||
'desc' => esc_html__( 'Select a time format.', 'opalestate-pro' ),
|
||||
'id' => 'time_format',
|
||||
'type' => 'select',
|
||||
'options' => opalestate_get_time_formats(),
|
||||
'default' => '12_hour',
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
+116
-75
@@ -288,15 +288,15 @@ class Opalestate_Settings_Property_Tab extends Opalestate_Settings_Base_Tab {
|
||||
];
|
||||
|
||||
$fields[] = [
|
||||
'name' => esc_html__( 'Field type', 'opalestate-pro' ),
|
||||
'options' => [
|
||||
'name' => esc_html__( 'Field type', 'opalestate-pro' ),
|
||||
'options' => [
|
||||
'select' => esc_html__( 'Select', 'opalestate-pro' ),
|
||||
'range' => esc_html__( 'Range', 'opalestate-pro' ),
|
||||
'text' => esc_html__( 'Text', 'opalestate-pro' ),
|
||||
],
|
||||
'id' => $meta['id'] . '_search_type',
|
||||
'type' => 'radio_inline',
|
||||
'default' => 'select',
|
||||
'id' => $meta['id'] . '_search_type',
|
||||
'type' => 'radio_inline',
|
||||
'default' => 'select',
|
||||
];
|
||||
|
||||
$fields[] = [
|
||||
@@ -361,6 +361,20 @@ class Opalestate_Settings_Property_Tab extends Opalestate_Settings_Base_Tab {
|
||||
'default' => 'on',
|
||||
];
|
||||
|
||||
$fields[] = [
|
||||
'name' => esc_html__( 'Request Viewing Time Range (minute)', 'opalestate-pro' ),
|
||||
'desc' => esc_html__( 'Time range from 1-60 minutes.', 'opalestate-pro' ),
|
||||
'id' => 'request_viewing_time_range',
|
||||
'type' => 'text_small',
|
||||
'attributes' => [
|
||||
'type' => 'number',
|
||||
'min' => 1,
|
||||
'max' => 60,
|
||||
],
|
||||
'default' => 15,
|
||||
'after_row' => '<hr>',
|
||||
];
|
||||
|
||||
$fields[] = [
|
||||
'name' => esc_html__( 'Show Amenities tab', 'opalestate-pro' ),
|
||||
'desc' => esc_html__( 'Show Amenities tab in the single property page.', 'opalestate-pro' ),
|
||||
@@ -373,102 +387,123 @@ class Opalestate_Settings_Property_Tab extends Opalestate_Settings_Base_Tab {
|
||||
];
|
||||
|
||||
$fields[] = [
|
||||
'name' => esc_html__( 'Show Facilities tab', 'opalestate-pro' ),
|
||||
'desc' => esc_html__( 'Show Facilities tab in the single property page.', 'opalestate-pro' ),
|
||||
'id' => 'enable_single_facilities',
|
||||
'type' => 'switch',
|
||||
'options' => [
|
||||
'name' => esc_html__( 'Hide Unset amenities', 'opalestate-pro' ),
|
||||
'desc' => esc_html__( 'Hide unset amenities. Default: Show unset amenities with disable icons.', 'opalestate-pro' ),
|
||||
'id' => 'hide_unset_amenities',
|
||||
'type' => 'switch',
|
||||
'options' => [
|
||||
'on' => esc_html__( 'Enable', 'opalestate-pro' ),
|
||||
'off' => esc_html__( 'Disable', 'opalestate-pro' ),
|
||||
],
|
||||
'after_row' => '<hr>',
|
||||
];
|
||||
|
||||
$fields[] = [
|
||||
'name' => esc_html__( 'Show Attachments tab', 'opalestate-pro' ),
|
||||
'desc' => esc_html__( 'Show Attachments tab in the single property page.', 'opalestate-pro' ),
|
||||
'id' => 'enable_single_attachments',
|
||||
'type' => 'switch',
|
||||
'options' => [
|
||||
'name' => esc_html__( 'Show Facilities tab', 'opalestate-pro' ),
|
||||
'desc' => esc_html__( 'Show Facilities tab in the single property page.', 'opalestate-pro' ),
|
||||
'id' => 'enable_single_facilities',
|
||||
'type' => 'switch',
|
||||
'options' => [
|
||||
'on' => esc_html__( 'Enable', 'opalestate-pro' ),
|
||||
'off' => esc_html__( 'Disable', 'opalestate-pro' ),
|
||||
],
|
||||
'after_row' => '<hr>',
|
||||
];
|
||||
|
||||
$fields[] = [
|
||||
'name' => esc_html__( 'Show Video tab', 'opalestate-pro' ),
|
||||
'desc' => esc_html__( 'Show Video tab in the single property page.', 'opalestate-pro' ),
|
||||
'id' => 'enable_single_video',
|
||||
'type' => 'switch',
|
||||
'options' => [
|
||||
'name' => esc_html__( 'Show Attachments tab', 'opalestate-pro' ),
|
||||
'desc' => esc_html__( 'Show Attachments tab in the single property page.', 'opalestate-pro' ),
|
||||
'id' => 'enable_single_attachments',
|
||||
'type' => 'switch',
|
||||
'options' => [
|
||||
'on' => esc_html__( 'Enable', 'opalestate-pro' ),
|
||||
'off' => esc_html__( 'Disable', 'opalestate-pro' ),
|
||||
],
|
||||
'after_row' => '<hr>',
|
||||
];
|
||||
|
||||
$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' => [
|
||||
'name' => esc_html__( 'Show Video tab', 'opalestate-pro' ),
|
||||
'desc' => esc_html__( 'Show Video tab in the single property page.', 'opalestate-pro' ),
|
||||
'id' => 'enable_single_video',
|
||||
'type' => 'switch',
|
||||
'options' => [
|
||||
'on' => esc_html__( 'Enable', 'opalestate-pro' ),
|
||||
'off' => esc_html__( 'Disable', 'opalestate-pro' ),
|
||||
],
|
||||
'after_row' => '<hr>',
|
||||
];
|
||||
|
||||
$fields[] = [
|
||||
'name' => esc_html__( 'Show Map tab', 'opalestate-pro' ),
|
||||
'desc' => esc_html__( 'Show Map tab in the single property page.', 'opalestate-pro' ),
|
||||
'id' => 'enable_single_map',
|
||||
'type' => 'switch',
|
||||
'options' => [
|
||||
'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' ),
|
||||
],
|
||||
'after_row' => '<hr>',
|
||||
];
|
||||
|
||||
$fields[] = [
|
||||
'name' => esc_html__( 'Show Nearby tab', 'opalestate-pro' ),
|
||||
'desc' => esc_html__( 'Show Nearby tab in the single property page.', 'opalestate-pro' ),
|
||||
'id' => 'enable_single_nearby',
|
||||
'type' => 'switch',
|
||||
'options' => [
|
||||
'name' => esc_html__( 'Show Map tab', 'opalestate-pro' ),
|
||||
'desc' => esc_html__( 'Show Map tab in the single property page.', 'opalestate-pro' ),
|
||||
'id' => 'enable_single_map',
|
||||
'type' => 'switch',
|
||||
'options' => [
|
||||
'on' => esc_html__( 'Enable', 'opalestate-pro' ),
|
||||
'off' => esc_html__( 'Disable', 'opalestate-pro' ),
|
||||
],
|
||||
'after_row' => '<hr>',
|
||||
];
|
||||
|
||||
$fields[] = [
|
||||
'name' => esc_html__( 'Show Walk Scores tab', 'opalestate-pro' ),
|
||||
'desc' => esc_html__( 'Show Walk Scores tab in the single property page.', 'opalestate-pro' ),
|
||||
'id' => 'enable_single_walkscores',
|
||||
'type' => 'switch',
|
||||
'options' => [
|
||||
'name' => esc_html__( 'Show Nearby tab', 'opalestate-pro' ),
|
||||
'desc' => esc_html__( 'Show Nearby tab in the single property page.', 'opalestate-pro' ),
|
||||
'id' => 'enable_single_nearby',
|
||||
'type' => 'switch',
|
||||
'options' => [
|
||||
'on' => esc_html__( 'Enable', 'opalestate-pro' ),
|
||||
'off' => esc_html__( 'Disable', 'opalestate-pro' ),
|
||||
],
|
||||
'after_row' => '<hr>',
|
||||
];
|
||||
|
||||
$fields[] = [
|
||||
'name' => esc_html__( 'Show Apartments tab', 'opalestate-pro' ),
|
||||
'desc' => esc_html__( 'Show Apartments tab in the single property page.', 'opalestate-pro' ),
|
||||
'id' => 'enable_single_apartments',
|
||||
'type' => 'switch',
|
||||
'options' => [
|
||||
'name' => esc_html__( 'Show Walk Scores tab', 'opalestate-pro' ),
|
||||
'desc' => esc_html__( 'Show Walk Scores tab in the single property page.', 'opalestate-pro' ),
|
||||
'id' => 'enable_single_walkscores',
|
||||
'type' => 'switch',
|
||||
'options' => [
|
||||
'on' => esc_html__( 'Enable', 'opalestate-pro' ),
|
||||
'off' => esc_html__( 'Disable', 'opalestate-pro' ),
|
||||
],
|
||||
'after_row' => '<hr>',
|
||||
];
|
||||
|
||||
$fields[] = [
|
||||
'name' => esc_html__( 'Show Floor Plans tab', 'opalestate-pro' ),
|
||||
'desc' => esc_html__( 'Show Floor Plans tab in the single property page.', 'opalestate-pro' ),
|
||||
'id' => 'enable_single_floor_plans',
|
||||
'type' => 'switch',
|
||||
'options' => [
|
||||
'name' => esc_html__( 'Show Apartments tab', 'opalestate-pro' ),
|
||||
'desc' => esc_html__( 'Show Apartments tab in the single property page.', 'opalestate-pro' ),
|
||||
'id' => 'enable_single_apartments',
|
||||
'type' => 'switch',
|
||||
'options' => [
|
||||
'on' => esc_html__( 'Enable', 'opalestate-pro' ),
|
||||
'off' => esc_html__( 'Disable', 'opalestate-pro' ),
|
||||
],
|
||||
'after_row' => '<hr>',
|
||||
];
|
||||
|
||||
$fields[] = [
|
||||
'name' => esc_html__( 'Show Floor Plans tab', 'opalestate-pro' ),
|
||||
'desc' => esc_html__( 'Show Floor Plans tab in the single property page.', 'opalestate-pro' ),
|
||||
'id' => 'enable_single_floor_plans',
|
||||
'type' => 'switch',
|
||||
'options' => [
|
||||
'on' => esc_html__( 'Enable', 'opalestate-pro' ),
|
||||
'off' => esc_html__( 'Disable', 'opalestate-pro' ),
|
||||
],
|
||||
'after_row' => '<hr>',
|
||||
];
|
||||
|
||||
$fields[] = [
|
||||
@@ -493,6 +528,7 @@ class Opalestate_Settings_Property_Tab extends Opalestate_Settings_Base_Tab {
|
||||
'max' => 365,
|
||||
],
|
||||
'default' => 8,
|
||||
'after_row' => '<hr>',
|
||||
];
|
||||
|
||||
$fields[] = [
|
||||
@@ -507,52 +543,57 @@ class Opalestate_Settings_Property_Tab extends Opalestate_Settings_Base_Tab {
|
||||
];
|
||||
|
||||
$fields[] = [
|
||||
'name' => esc_html__( 'Login to show Author box', 'opalestate-pro' ),
|
||||
'desc' => esc_html__( 'Require users login to show Author box', 'opalestate-pro' ),
|
||||
'id' => 'enable_single_login_to_show_author_box',
|
||||
'type' => 'switch',
|
||||
'options' => [
|
||||
'name' => esc_html__( 'Login to show Author box', 'opalestate-pro' ),
|
||||
'desc' => esc_html__( 'Require users login to show Author box', 'opalestate-pro' ),
|
||||
'id' => 'enable_single_login_to_show_author_box',
|
||||
'type' => 'switch',
|
||||
'options' => [
|
||||
'on' => esc_html__( 'Enable', 'opalestate-pro' ),
|
||||
'off' => esc_html__( 'Disable', 'opalestate-pro' ),
|
||||
],
|
||||
'after_row' => '<hr>',
|
||||
];
|
||||
|
||||
$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' => [
|
||||
'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' ),
|
||||
],
|
||||
'after_row' => '<hr>',
|
||||
];
|
||||
|
||||
$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' => [
|
||||
'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' ),
|
||||
],
|
||||
'after_row' => '<hr>',
|
||||
];
|
||||
|
||||
$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(),
|
||||
'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' => '<hr>',
|
||||
];
|
||||
|
||||
$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(),
|
||||
'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' => '<hr>',
|
||||
];
|
||||
|
||||
return $fields;
|
||||
|
||||
@@ -712,7 +712,7 @@ class OpalEstate_User_Message {
|
||||
'id' => "{$prefix}time",
|
||||
'name' => esc_html__( 'Time', 'opalestate-pro' ),
|
||||
'type' => 'select',
|
||||
'options' => opalestate_get_time_lapses(),
|
||||
'options' => opalestate_get_request_viewing_time_list(),
|
||||
],
|
||||
[
|
||||
'id' => "{$prefix}phone",
|
||||
|
||||
+33
-4
@@ -133,8 +133,14 @@ function opalestate_upload_base64_image( $file, $parent_id = 0 ) {
|
||||
return $attach_id;
|
||||
}
|
||||
|
||||
function opalestate_get_request_viewing_time_list() {
|
||||
$range_time = opalestate_get_option( 'request_viewing_time_range', 15 );
|
||||
|
||||
return apply_filters( 'opalestate_request_viewing_time_list', opalestate_get_time_lapses( $range_time ) );
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Gets time lapses.
|
||||
*/
|
||||
function opalestate_get_time_lapses( $lapse = 15 ) {
|
||||
|
||||
@@ -147,9 +153,20 @@ function opalestate_get_time_lapses( $lapse = 15 ) {
|
||||
$end_str = strtotime( $end );
|
||||
$now_str = $start_str;
|
||||
|
||||
$time_format_value = 'h:i a';
|
||||
$time_format_show = 'h:i A';
|
||||
|
||||
if ( '24_hour' === opalestate_get_option( 'time_format' ) ) {
|
||||
$time_format_value = 'H:i';
|
||||
$time_format_show = 'H:i';
|
||||
}
|
||||
|
||||
$time_format_value = apply_filters( 'opalestate_time_lapse_value', $time_format_value );
|
||||
$time_format_show = apply_filters( 'opalestate_time_lapse_show', $time_format_show );
|
||||
|
||||
while ( $now_str <= $end_str ) {
|
||||
$output[ date( 'h:i a', $now_str ) ] = date( 'h:i A', $now_str );
|
||||
$now_str = strtotime( $interval, $now_str );
|
||||
$output[ date( $time_format_value, $now_str ) ] = date( $time_format_show, $now_str );
|
||||
$now_str = strtotime( $interval, $now_str );
|
||||
}
|
||||
|
||||
return $output;
|
||||
@@ -1199,7 +1216,7 @@ add_action( 'opalestate_after_search_properties_form', 'opalestate_add_hidden_mu
|
||||
* @return array
|
||||
*/
|
||||
function opalestate_get_measurement_units() {
|
||||
return apply_filters( 'opalestate_measurement_unit', [
|
||||
return apply_filters( 'opalestate_measurement_units', [
|
||||
'sqft' => esc_html__( 'sq ft', 'opalestate-pro' ),
|
||||
'sqm' => esc_html__( 'sq m', 'opalestate-pro' ),
|
||||
'mq' => esc_html__( 'mq', 'opalestate-pro' ),
|
||||
@@ -1207,6 +1224,18 @@ function opalestate_get_measurement_units() {
|
||||
] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets time formats.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function opalestate_get_time_formats() {
|
||||
return apply_filters( 'opalestate_time_formats', [
|
||||
'12_hour' => esc_html__( '12-hour', 'opalestate-pro' ),
|
||||
'24_hour' => esc_html__( '24-hour', 'opalestate-pro' ),
|
||||
] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns property statuses.
|
||||
*
|
||||
|
||||
@@ -343,3 +343,12 @@ function opalestate_single_property_sidebar_widgets() {
|
||||
}
|
||||
|
||||
add_action( 'opalestate_single_property_sidebar', 'opalestate_single_property_sidebar_widgets', 99 );
|
||||
|
||||
function opalestate_hide_unset_amenities( $show ) {
|
||||
if ( 'off' === opalestate_get_option( 'hide_unset_amenities', 'off' ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
add_filter( 'opalestate_hide_unset_amenity', 'opalestate_hide_unset_amenities' );
|
||||
|
||||
Reference in New Issue
Block a user