' . esc_html__( 'Request Viewing', 'opalestate-pro' ) . '
';
}
/**
* Get single layout.
*
* @param string $layout Layout.
*/
function opalestate_single_property_layout( $layout ) {
switch ( $layout ) {
case 'v2':
opalestate_single_property_layout_v2();
break;
case 'v3':
opalestate_single_property_layout_v3();
break;
case 'v4':
opalestate_single_property_layout_v4();
break;
case 'v5':
opalestate_single_property_layout_v5();
break;
default:
opalestate_single_property_layout_default();
break;
}
}
add_action( 'opalestate_single_property_layout', 'opalestate_single_property_layout' );
/**
* Forms
*/
function opalestate_property_request_view_form() {
if ( 'on' != opalestate_get_option( 'enable_single_request_viewing', 'on' ) ) {
return;
}
if ( ! is_user_logged_in() ) {
return;
}
if ( ! is_single_property() ) {
return;
}
$object = OpalEstate_User_Message::get_instance();
$fields = $object->get_request_review_form_fields();
$form = OpalEstate()->html->render_form( $fields );
$description = esc_html__( 'Physical Arrange viewings is always been attractive to property clients. Fill out the form to arrange visualizations around our properties.', 'opalestate-pro' );
$atts = [
'heading' => esc_html__( 'Request Viewing', 'opalestate-pro' ),
'description' => $description,
'id' => 'property-request-view',
'form' => $form,
];
echo opalestate_load_template_path( 'messages/request-reviewing-form', $atts );
}
add_action( 'wp_footer', 'opalestate_property_request_view_form', 9 );
function opalestate_property_equiry_form() {
echo opalestate_load_template_path( 'messages/enquiry-form' );
}
if ( ! function_exists( "opalestate_login_register_form_popup" ) ) {
function opalestate_login_register_form_popup() {
echo opalestate_load_template_path( 'user/my-account-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' );
return $post_templates;
}
add_filter( 'theme_page_templates', 'opalestate_add_template_to_select', 10, 4 );
function opalestate_load_plugin_template( $template ) {
if ( get_page_template_slug() === 'user-management.php' ) {
if ( $theme_file = locate_template( [ 'page-templates/user-management.php', 'user-management.php' ] ) ) {
$template = $theme_file;
} else {
$template = OPALESTATE_PLUGIN_DIR . '/templates/user-management.php';
}
} elseif ( get_page_template_slug() === 'fullwidth-page.php' ) {
if ( $theme_file = locate_template( [ 'page-templates/fullwidth-page.php', 'fullwidth-page.php' ] ) ) {
$template = $theme_file;
} else {
$template = OPALESTATE_PLUGIN_DIR . '/templates/fullwidth-page.php';
}
}
if ( $template == '' ) {
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' );