WP Residence Help WP Residence Help

  • WpEstate
  • How to Build Your Website
  • Video Tutorials
  • Client Support
  • API
Home / Technical how to | Custom Code Required / How to keep floor plans closed by default on property page. How to disable floor plan lightbox

How to keep floor plans closed by default on property page. How to disable floor plan lightbox

2644 views 0

To resolve the issue with floor plans in the theme, follow these steps:

Modify the Floor Plan Section

Go to libs/property_page_functions/property_floor_plan_section_functions.php and locate the function:

if ( ! function_exists( 'estate_floor_plan' ) ) :
function estate_floor_plan( $post_id, $is_print = 0, $wpestate_prop_all_details = '' ) {
    // Set up print class if needed
    $is_print_class = $is_print ? ' floor_print_class ' : '';

    // Get measurement unit
    $unit = wpestate_get_meaurement_unit_formated();

    // Fetch floor plan data
    $plan_data = estate_get_floor_plan_data( $post_id, $wpestate_prop_all_details );

    // Set up currency details
    $wpestate_currency  = esc_html( wpresidence_get_option( 'wp_estate_currency_symbol', '' ) );
    $where_currency     = esc_html( wpresidence_get_option( 'wp_estate_where_currency_symbol', '' ) );

    // Initialize lightbox content and counter
    $lightbox = '';
    $counter  = 0;
    $show     = ' style="display:none"; ';

    // Display floor plans
    if ( is_array( $plan_data['titles'] ) ) {
        print '<div class="row ' . esc_attr( $is_print_class ) . '">';

        foreach ( $plan_data['titles'] as $key => $plan_name ) {
            $counter++;
            estate_display_single_floor_plan( $key, $plan_data, $unit, $wpestate_currency, $where_currency, $is_print_class, $show, $counter );
            $lightbox .= estate_generate_lightbox_content( 
                $plan_data['titles'][$key], 
                $plan_data['descriptions'][$key], 
                $plan_data['image_attachs'][$key], 
                estate_get_plan_details( $key, $plan_data, $unit, $wpestate_currency, $where_currency ), 
                $counter 
            );
            $show = '';
        }

        // Enqueue necessary scripts
        wp_enqueue_script( 'owl_carousel' );

        // Include floor plans gallery template
        include( locate_template( 'templates/listing_templates/floorplans_gallery.php' ) );

        // Add inline script to initialize lightbox
        wp_add_inline_script( 'owl_carousel', '
            jQuery(document).ready(function($){
                estate_start_lightbox_floorplans();
            });
        ' );

        print '</div>';
    }
}
endif;

To change the variable $show, update it to:

$show = ' style="display:none"; ';

How to Disable Floor Plan Lightbox

To disable the floor plan lightbox, go to libs/property_page_functions/property_floor_plan_section_functions.php and locate the function estate_floor_plan. Remove the following lines:

wp_add_inline_script( 'owl_carousel', '
    jQuery(document).ready(function($){
        estate_start_lightbox_floorplans();
    });
');

How to Remove the Floor Plan Image Link

To remove the floor plan image link, go to libs/property_page_functions/property_floor_plan_section_functions.php and locate the function estate_display_floor_plan_image. Remove the <a> tags around the image.

function estate_display_floor_plan_image( $plan_name, $plan_desc, $full_img_path, $is_print_class, $show, $counter ) {
?>
<div class="front_plan_row_image <?php echo esc_attr( $is_print_class ); ?>">
    <div class="floor_image">
        <img class="lightbox_trigger_floor" src="<?php echo esc_url( $full_img_path ); ?>" 
            alt="<?php echo esc_attr( $plan_name ); ?>" 
            data-slider-no="<?php echo esc_attr( $counter ); ?>" />
    </div>
    <div class="floor_description"></div>
</div>
<?php
}
Technical how to | Custom Code Required

Related Articles

  • Technical – How to Change the Minimum Image Dimensions for Property Uploads in WPResidence
  • Introduction to WPResidence Header Customization
  • Understanding WPResidence Header Types: An Overview
  • Customizing the WPResidence Logo Display

WP Residence Documentation

  • 1. General
    • How to Get Support
    • Get your buyer license code.
    • Use SSL / https
    • Server / Theme Requirements
  • 2. Installation
  • 3. Installation FAQ
  • 4. Advanced Search
    • Advanced Search Display Settings
    • Advanced Search Form
    • Geolocation Search for Half Map
    • Save Search Theme Options
    • Advanced Search Colors
  • 5. Agent, Agency & Developers
  • 6. Property Page
  • 7. Properties List
  • 8. Property Taxonomies
  • WpResidence Elementor Studio
  • 10. Blog Posts & Blog List
  • 11. Shortcodes
    • Contact Form
    • Featured Agency/Developer
    • Membership Packages
    • Testimonials
    • Google Map with Property Marker
    • Listings per Agent, Agency or Developer
    • Display Categories
    • Agent List
    • Recent Items Slider
    • Recent items
    • List Properties or Articles by ID
    • Featured Agent
    • Featured Article
    • Featured Property
    • Login & Register Form
    • Icon Content Box Shortcode
  • 12. Widgets
  • Theme Options
    • General Settings
    • User Types Settings
    • Appearance
    • Logos & Favicon
    • Header
    • Footer Style and Colors
    • Price & Currency
    • Property Custom Fields
    • Features & Amenities
    • Listing Labels
    • Theme Slider
    • Permalinks
    • Splash Page
    • Social & Contact
    • Map Settings
    • Pin Management
    • How read from file works
    • General Design Settings
    • Custom Colors Settings
    • Header Design & Colors
    • Mobile Menu Colors
    • User Dashboard Colors
    • Print PDF Design
    • Property, Agent, Blog Lists Design Settings
    • Sidebar Widget Design
    • Font management
    • How to add custom CSS
    • Custom Property Card Unit – Beta version
    • Email Management
    • Import & Export theme options
    • reCaptcha settings
    • YELP API Integration
    • iHomefinder Optima Express IDX
    • MEMBERSHIP & PAYMENT Settings
    • Property Submission Page
    • PayPal Setup
    • Stripe Setup
    • Wire Transfer Payment Method
  • Translation
  • FAQ
  • Pages
  • Header
  • Footer
  • Google or Open Street Maps
  • Payment Options
  • Plugins
    • Included Plugins
    • Third Party Plugins – IDX Compatibility
    • Third Party Plugins – Multi Languages
    • Third party Plugins – Other
  • Technical
    • Technical how to | Custom Code Required
    • Technical: Child Theme

Join Us On

Powered by WP Estate - All Rights Reserved
  • WpEstate
  • How to Build Your Website
  • Video Tutorials
  • Client Support
  • API