WP Residence Help WP Residence Help

  • WPRESIDENCE
  • 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

2899 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: Change the Schedule Tour Email Text and the Form Default Message
  • Property list filter customization
  • Technical – How to Change the Minimum Image Dimensions for Property Uploads in WPResidence
  • Introduction to WPResidence Header Customization

Help Categories

  • 18Agent, Agency & Developers
  • 5Blog Posts & Blog Lists
  • 38Elementor Shortcodes Built-In
  • 56FAQ
  • 15Footer
  • 5Getting Started
  • 37Header
  • 2IDX & MLSImport
  • 6Installation & Setup
  • 22Installation FAQ
  • 23Maps & Location Settings
  • 21Multi-Language Third Party Plugins
  • 6Other Third party Plugins
  • 19Pages
  • 4Payments & Monetization
  • 20Property Lists, Categories & Archive
  • 36Property Pages & Layouts
  • 31Search & Filtering
  • 163Technical how to | Custom Code Required
  • 8Technical: Actions and filters
  • 6Technical: Child Theme
  • 86Theme Options & Global Settings
  • 6Translations & Languages
  • 16WPBakery Shortcodes
  • 51WPResidence / WPEstate CRM
  • 50WPResidence 5.0 Documentation
  • 8WPResidence Elementor Studio
  • 50WPResidence Translate Plugin

Join Us On

Powered by WP Estate - All Rights Reserved
  • WPRESIDENCE
  • Video Tutorials
  • Client Support
  • API