<?php
if ( ! defined( 'ABSPATH' ) ) {
    exit; // Exit if accessed directly
}
get_header('ere');
/**
 * ere_before_main_content hook.
 *
 * @hooked ere_output_content_wrapper_start - 10 (outputs opening divs for the content)
 */
?>
<?php while ( have_posts() ) : the_post(); ?>
    <div id="post-<?php the_ID(); ?>" <?php post_class('external-div'); ?>>
        <div class="box-image-page">
            <?php if ( has_post_thumbnail() ) : ?>
                <!-- If post has thumbnail, apply parallax background with header settings -->
                <div class="featured-image" 
                     style="background-image: url('<?php echo esc_url( get_the_post_thumbnail_url( get_the_ID(), 'full' ) ); ?>'); 
                            background-size: cover;
                            background-position: <?php echo esc_attr( get_theme_mod( 'estate_brokerage_services_header_background_position', 'center' ) ); ?>;
                            background-attachment: <?php echo esc_attr( get_theme_mod( 'estate_brokerage_services_header_background_attachment', 'scroll' ) ? 'fixed' : 'scroll' ); ?>;
                            height: <?php echo esc_attr( get_theme_mod( 'estate_brokerage_services_header_image_height', 400 ) ); ?>px;">
                </div>
            <?php else : ?>
                <!-- Fallback image for pages with no thumbnail -->
                <div class="single-page-img"></div>
            <?php endif; ?>
        </div> 
        <div class="box-text">
            <h2><?php echo esc_html( get_the_title() ); ?></h2>  
        </div> 
    </div>
<?php endwhile; ?>
<div class="my-single-box">
    <div class="container-fluid py-5">
        <div class="flex-row">
            <div class="main-div-content">
                <?php
                do_action( 'ere_before_main_content' );
                do_action('ere_single_property_before_main_content');
                if (have_posts()):
                    while (have_posts()): the_post(); ?>
                        <?php ere_get_template_part('content', 'single-property'); ?>
                    <?php endwhile;
                endif;
                do_action('ere_single_property_after_main_content');
                /**
                 * ere_after_main_content hook.
                 *
                 * @hooked ere_output_content_wrapper_end - 10 (outputs closing divs for the content)
                 */
                do_action( 'ere_after_main_content' );
                ?>
            </div>
            <div class="main-div-sidebar" id="theme-sidebar">
                <?php 
                /**
                 * ere_sidebar_property hook.
                 *
                 * @hooked ere_sidebar_property - 10
                 */
                do_action('ere_sidebar_property');?>
            </div>
        </div>
    </div>
</div>
<?php get_footer('ere');
