<?php
/**
 * Template Name: Custom Home
 */
get_header(); ?>

<main id="skip-content" role="main">

	<?php do_action( 'luzuk_real_estate_services_above_slider' ); ?>

	<?php if( get_theme_mod('luzuk_real_estate_services_slider_hide_show') != ''){ ?>
	<section id="slider">	  
		
			<div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
			    <?php $luzuk_real_estate_services_slider_pages = array();
			    for ( $count = 1; $count <= 4; $count++ ) {
			        $mod = intval( get_theme_mod( 'luzuk_real_estate_services_slider'. $count ));
			        if ( 'page-none-selected' != $mod ) {
			          $luzuk_real_estate_services_slider_pages[] = $mod;
			        }
			    }
		      	if( !empty($luzuk_real_estate_services_slider_pages) ) :
			        $args = array(
			          	'post_type' => 'page',
			          	'post__in' => $luzuk_real_estate_services_slider_pages,
			          	'orderby' => 'post__in'
			        );
		        	$query = new WP_Query( $args );
		        if ( $query->have_posts() ) :
		          	$i = 1;
		    	?>   
		    	 <div class="carousel-inner" role="listbox">
		    	<div class="container">   
				   
				      	<?php  while ( $query->have_posts() ) : $query->the_post(); ?>
				        <div <?php if($i == 1){echo 'class="carousel-item fade-in-image active"';} else{ echo 'class="carousel-item fade-in-image"';}?>>
						<?php
							$luzuk_real_estate_services_slider_effect = get_theme_mod('luzuk_real_estate_services_slider_effect', '') 
						?>
							<div class="content <?php echo ($luzuk_real_estate_services_slider_effect); ?>">
								<h5><?php echo esc_html(get_theme_mod('luzuk_real_estate_services_slider_heading')); ?></h5>
								<h2><?php the_title(); ?></h2>
								<?php 
									$luzuk_real_estate_services_slider_excerpt_length = get_theme_mod('luzuk_real_estate_services_slider_excerpt_length','15');
								
									if( $luzuk_real_estate_services_slider_excerpt_length != ''){?>
									<p class="mb-0"><?php $luzuk_real_estate_services_excerpt = get_the_excerpt(); echo esc_html( luzuk_real_estate_services_string_limit_words( $luzuk_real_estate_services_excerpt, esc_attr(get_theme_mod('luzuk_real_estate_services_slider_excerpt_length','15') ) )); ?></p>
								<?php } ?>
								<div class="read-btn sbtn1">
									<a href="<?php echo esc_url(get_theme_mod('luzuk_real_estate_services_sliderbtnlink')) ?>" >
										<?php _e( 'Book Now', 'real-estate-services' ); ?> 
									</a>
								</div>
							</div>
												
							<div class="slideimg">
								<?php
									// Check if the post has a thumbnail
									if (has_post_thumbnail()) {
										// If post has thumbnail, display it
										?>
										<img src="<?php echo esc_url(get_the_post_thumbnail_url(get_the_ID(), 'full')); ?>" alt="<?php the_title_attribute(); ?>" />
										<?php
									} else {
										// If post does not have thumbnail, display default image
										?>
										<img src="<?php echo esc_url(get_template_directory_uri() . '/assets/images/abt1.jpg'); ?>" alt="Default Image" />
										<?php
									}

								?>
								<div class="slider-overlay"></div>
							</div>								
							
				        </div>
				      	<?php $i++; endwhile; 
				      	wp_reset_postdata();?>
				    </div>
			    <?php else : ?>

			    	</div>
			    	<div class="no-postfound"></div>
	      		<?php endif;
			    endif;?>
			<div class="slidebtn">
			    <a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev">
					<svg width="36.735" height="90.151" viewBox="0 0 36.735 90.151">
						<path id="Path_6" data-name="Path 6" d="M80.4,10.579a9.341,9.341,0,0,0-8.969,6.953,26.165,26.165,0,0,1-50.443,0,9.341,9.341,0,0,0-8.969-6.953H9.26A9.26,9.26,0,0,1,0,1.318V0H90.151V1.318a9.26,9.26,0,0,1-9.26,9.26Z" transform="translate(0 90.151) rotate(-90)"></path>
					</svg>  	
					<span class="carousel-control-prev-icon" aria-hidden="true">
					  <i class="fas fa-chevron-left"></i>
			      	</span>
			      	<span class="screen-reader-text"><?php esc_html_e( 'Prev','real-estate-services' );?></span>
			    </a>
			    <a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next">
					<svg width="36.735" height="90.151" viewBox="0 0 36.735 90.151">
						<path id="Path_5" data-name="Path 5" d="M80.4,26.156A9.341,9.341,0,0,1,71.43,19.2a26.165,26.165,0,0,0-50.443,0,9.341,9.341,0,0,1-8.969,6.953H9.26A9.26,9.26,0,0,0,0,35.417v1.318H90.151V35.417a9.26,9.26,0,0,0-9.26-9.26Z" transform="translate(0 90.151) rotate(-90)"></path>
					</svg>
					<span class="carousel-control-next-icon" aria-hidden="true">
					  <i class="fas fa-chevron-right"></i>
			      	</span>
			      	<span class="screen-reader-text"><?php esc_html_e( 'Next','real-estate-services' );?></span>
			    </a>
				<!-- <ol class="carousel-indicators">
                    <//?php for ($j = 0; $j < $i; $j++) : ?>
                        <li data-target="#carouselExampleIndicators" data-slide-to="<?php echo $j; ?>" class="<?php if ($j === 0) echo 'active'; ?>"></li>
                    <//?php endfor; ?>
                </ol> -->
			</div>
		  	<div class="clearfix"></div>
		</div> 
	</section>
	<?php }?>
	
	<?php do_action('luzuk_real_estate_services_below_slider'); ?>

	<section id="feature-section" class="py-5">
		<div class="container"> 
			<div class="head row">
				<div class="col-md-8 pd-0">
					<h4 class="subheading"><?php echo esc_html(get_theme_mod('luzuk_real_estate_services_featuresubheading')); ?></h4>
					<h2 class="heading"><?php echo esc_html(get_theme_mod('luzuk_real_estate_services_featureheading')); ?></h2>
				</div>
				<div class="col-md-4">
					<div class="featurehead-btn">
						<a href="<?php echo esc_html(get_theme_mod('luzuk_real_estate_services_feature_exploreallbtnlink')); ?>">
							<?php _e( 'Explore All', 'real-estate-services' ); ?>
							<i class="far fa-arrow-alt-circle-right"></i>
							<i class="far fa-long-arrow-right"></i>
						</a>
					</div>
				</div>
			</div>
			<div class="content">
				<div class="row mr-0">
				<?php
				// Check if any page is selected from customizer
				$pages_selected = false;
				for ($i = 1; $i <= 6; $i++) {
					$selected_page_id = get_theme_mod('luzuk_real_estate_services_page_setting_' . $i);
					if ($selected_page_id) {
						$pages_selected = true;
						break;
					}
				}
				?>

				<!-- <div class="owl-carousel owl-theme row"> -->
					<?php
					// Display pages in slider if selected, otherwise show a message
					if ($pages_selected) {
						// Loop through each selected page and display in the slider
						for ($i = 1; $i <= 3; $i++) {
							$selected_page_id = get_theme_mod('luzuk_real_estate_services_page_setting_' . $i);
							if ($selected_page_id) {
								$page = get_post($selected_page_id);
								?>
								<div class="feabx col-lg-4 col-md-12 col-sm-12">
									<div class="feabxinn">
										<a href="<?php echo get_permalink($page->ID); ?>">
											<?php echo get_the_post_thumbnail($page->ID, 'medium'); ?>
										</a>
										<h6 class="address"><i class="fas fa-map-marker-alt"></i><?php echo esc_html(get_theme_mod('luzuk_real_estate_services_feture_address_page'. $i)); ?></h6>
										<a href="<?php echo get_permalink($page->ID); ?>">
											<h4><?php echo $page->post_title; ?></h4>
										</a>
										<div class="land-areadata row">
											<div class="col-lg-6 col-md-6 col-sm-6 pd-0">
												<p class="dimension"><i class="far fa-square"></i><?php echo esc_html(get_theme_mod('luzuk_real_estate_services_feture_dimension_page'. $i)); ?></p>
											</div>
											<div class="col-lg-6 col-md-6 col-sm-6 pd-0">
												<p class="meter"><i class="fas fa-chart-line"></i><?php echo esc_html(get_theme_mod('luzuk_real_estate_services_feture_meter_page'. $i)); ?></p>
											</div>
										</div>
										<div class="btnprice row">
											<div class="landbtn">
												<a href="<?php echo get_permalink($page->ID); ?>">
													<?php _e( 'Book Now', 'real-estate-services' ); ?>
												</a>										
											</div>
											<div class="landprice">
												<p class="pricetext"><?php echo esc_html(get_theme_mod('luzuk_real_estate_services_feture_pricetext_page'. $i)); ?></p>
												<h4 class="pricetext"><?php echo esc_html(get_theme_mod('luzuk_real_estate_services_feture_price_page'. $i)); ?></h4>
											</div>
										</div>
									</div>
								</div>
							<?php }
						}
					} else {
						// Display message if no pages are selected
						echo '<p>Please select page from customizer</p>';
					}
					?>
				</div>
			</div>
		</div>
	</section>

	<?php do_action('luzuk_real_estate_services_below_feature_section'); ?>

	<section id="aboutus-section">
		<div class="container">
			<div class="row">
				<div class="col-lg-6 col-md-6 col-sm-12">
					<div class="aboutus-head">
						<?php if(get_theme_mod('luzuk_real_estate_services_aboutus_subheading') != ''){?>
							<h6><?php echo esc_html(get_theme_mod('luzuk_real_estate_services_aboutus_subheading')); ?>
							</h6>
						<?php }?>

						<?php if(get_theme_mod('luzuk_real_estate_services_aboutus_heading') != ''){?>
							<h3><?php echo esc_html(get_theme_mod('luzuk_real_estate_services_aboutus_heading')); ?>
							</h3>
						<?php }?>
						
					</div>
					<div class="content">
						<div class="box1 box row">
							<div class="col-lg-2 col-md-3 col-sm-12">
								<div class="icnbx">
									<i class="<?php echo esc_html(get_theme_mod('luzuk_real_estate_services_aboutus_box1icon')); ?>"></i>
								</div>
							</div>
							<div class="col-lg-10 col-md-9 col-sm-12">
								<div class="conbx">
									<h4><?php echo esc_html(get_theme_mod('luzuk_real_estate_services_aboutus_box1heading')); ?></h4>
									<p><?php echo esc_html(get_theme_mod('luzuk_real_estate_services_aboutus_box1description')); ?></p>
								</div>
							</div>
						</div>
						<div class="box2 box row">
							<div class="col-lg-2 col-md-3 col-sm-12">
								<div class="icnbx">
									<i class="<?php echo esc_html(get_theme_mod('luzuk_real_estate_services_aboutus_box2icon')); ?>"></i>
								</div>
							</div>
							<div class="col-lg-10 col-md-9 col-sm-12">
								<div class="conbx">
									<h4><?php echo esc_html(get_theme_mod('luzuk_real_estate_services_aboutus_box2heading')); ?></h4>
									<p><?php echo esc_html(get_theme_mod('luzuk_real_estate_services_aboutus_box2description')); ?></p>
								</div>
							</div>
						</div>
						<div class="box3 box row">
							<div class="col-lg-2 col-md-3 col-sm-12">
								<div class="icnbx">
									<i class="<?php echo esc_html(get_theme_mod('luzuk_real_estate_services_aboutus_box3icon')); ?>"></i>
								</div>
							</div>
							<div class="col-lg-10 col-md-9 col-sm-12">
								<div class="conbx">
									<h4><?php echo esc_html(get_theme_mod('luzuk_real_estate_services_aboutus_box3heading')); ?></h4>
									<p><?php echo esc_html(get_theme_mod('luzuk_real_estate_services_aboutus_box3description')); ?></p>
								</div>
							</div>
						</div>
					</div>
				</div>
				<div class="col-lg-6 col-md-6 col-sm-12">
					<div class="imghead">
						<p><?php echo esc_html(get_theme_mod('luzuk_real_estate_services_aboutus_imgdescription')); ?></p>
					</div>
					<div class="mainaccordian">
						<div class="aboutarea-img wow zoomIn active" style="visibility: visible; animation-name: zoomIn;">
							<?php 
								$luzuk_real_estate_services_aboutus_img = get_theme_mod('luzuk_real_estate_services_aboutus_img');

								if(!empty($luzuk_real_estate_services_aboutus_img)){
									echo '<img alt="'. esc_html(get_the_title()) .'" src="'.esc_url($luzuk_real_estate_services_aboutus_img).'" class="img-responsive secondry-bg-img" />';
								}else{
									echo '<img alt="luzuk_real_estate_services_aboutus_img" src="'.get_template_directory_uri().'/assets/images/abotimg.png" class="img-responsive" />';
								}
							?>
							<div class="about-imgtitle"><span>LAND FOR SALE </span></div>
						</div>
						<div class="aboutarea-img wow zoomIn" style="visibility: visible; animation-name: zoomIn;">
							<?php 
								$luzuk_real_estate_services_aboutus_img = get_theme_mod('luzuk_real_estate_services_aboutus_img');

								if(!empty($luzuk_real_estate_services_aboutus_img)){
									echo '<img alt="'. esc_html(get_the_title()) .'" src="'.esc_url($luzuk_real_estate_services_aboutus_img).'" class="img-responsive secondry-bg-img" />';
								}else{
									echo '<img alt="luzuk_real_estate_services_aboutus_img" src="'.get_template_directory_uri().'/assets/images/abotimg.png" class="img-responsive" />';
								}
							?>
							<div class="about-imgtitle"><span>LAND FOR SALE </span></div>
						</div>
						<div class="aboutarea-img wow zoomIn" style="visibility: visible; animation-name: zoomIn;">
							<?php 
								$luzuk_real_estate_services_aboutus_img = get_theme_mod('luzuk_real_estate_services_aboutus_img');

								if(!empty($luzuk_real_estate_services_aboutus_img)){
									echo '<img alt="'. esc_html(get_the_title()) .'" src="'.esc_url($luzuk_real_estate_services_aboutus_img).'" class="img-responsive secondry-bg-img" />';
								}else{
									echo '<img alt="luzuk_real_estate_services_aboutus_img" src="'.get_template_directory_uri().'/assets/images/abotimg.png" class="img-responsive" />';
								}
							?>
							<div class="about-imgtitle"><span>LAND FOR SALE </span></div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</section>

	<?php do_action('luzuk_real_estate_services_below_aboutus_section'); ?>

	<div class="container">
	  	<?php while ( have_posts() ) : the_post(); ?>
	  		<div class="lz-content">
	        	<?php the_content(); ?>
	        </div>
	    <?php endwhile; // end of the loop. ?>
	</div>
</main>

<?php get_footer(); ?>