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

<main id="skip-content" role="main">
	<?php do_action( 'luzuk_experthandyman_above_slider' ); ?>

	<?php if( get_theme_mod('luzuk_experthandyman_slider_hide_show') != ''){ ?>
	<section id="slider">	  
		<div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
			<?php $luzuk_experthandyman_slider_pages = array();
			    for ( $count = 1; $count <= 4; $count++ ) {
			        $mod = intval( get_theme_mod( 'luzuk_experthandyman_slider'. $count ));
			        if ( 'page-none-selected' != $mod ) {
			          $luzuk_experthandyman_slider_pages[] = $mod;
			        }
			    }
		      	if( !empty($luzuk_experthandyman_slider_pages) ) :
			        $args = array(
			          	'post_type' => 'page',
			          	'post__in' => $luzuk_experthandyman_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"';}?>>
						<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 class="content">
							<h4><?php echo esc_html(get_theme_mod('luzuk_experthandyman_sliderheading')); ?></h4>
							<h2><?php the_title(); ?></h2>
							<?php 
								$luzuk_experthandyman_slider_excerpt_length = get_theme_mod('luzuk_experthandyman_slider_excerpt_length','15');
							
								if( $luzuk_experthandyman_slider_excerpt_length != ''){?>
								<p ><?php $luzuk_experthandyman_excerpt = get_the_excerpt(); echo esc_html( luzuk_experthandyman_string_limit_words( $luzuk_experthandyman_excerpt, esc_attr(get_theme_mod('luzuk_experthandyman_slider_excerpt_length','15') ) )); ?></p>
							<?php } ?>
							<div class="sbtn">
								<a href="<?php echo esc_url(get_theme_mod('luzuk_experthandyman_sliderbtnlink')) ?>">
									<?php esc_html_e( 'Learn More','expert-handyman' );?>
								</a>
							</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">			
					<span class="carousel-control-prev-icon" aria-hidden="true">
					  <i class="fas fa-caret-left"></i>
			      	</span>
			      	<span class="screen-reader-text"><?php esc_html_e( 'Prev','expert-handyman' );?></span>
			    </a>
			    <a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next">
					
					<span class="carousel-control-next-icon" aria-hidden="true">
					  <i class="fas fa-caret-right"></i>
			      	</span>
			      	<span class="screen-reader-text"><?php esc_html_e( 'Next','expert-handyman' );?></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_experthandyman_below_slider'); ?>

	<?php if (get_theme_mod('luzuk_experthandyman_feature_hideshow',true)) {?>
	<section id="feature-section">
		<div class="container"> 
			<div class="line1">
				<li><h2><?php echo esc_html(get_theme_mod('luzuk_experthandyman_feature_hightech')); ?></h2></li>
				<li><?php 
					$luzuk_experthandyman_featureimg1 = get_theme_mod('luzuk_experthandyman_feature_img1');

					if(!empty($luzuk_experthandyman_featureimg1)){
						echo '<img alt="'. esc_html(get_the_title()) .'" src="'.esc_url($luzuk_experthandyman_featureimg1).'" class="img-responsive secondry-bg-img" />';
					}else{
						echo '<img alt="luzuk_experthandyman_featureimg1" src="'.get_template_directory_uri().'/assets/images/bann1.jpg" class="img-responsive" />';
					}
				?></li>
				<li>
					<h2>
						<div class="linebrd"></div>
						<?php echo esc_html(get_theme_mod('luzuk_experthandyman_feature_installationrepair')); ?>
					</h2>
				</li>
			</div>

			<div class="line2">
				<li><?php 
					$luzuk_experthandyman_featureimg2 = get_theme_mod('luzuk_experthandyman_feature_img2');

					if(!empty($luzuk_experthandyman_featureimg2)){
						echo '<img alt="'. esc_html(get_the_title()) .'" src="'.esc_url($luzuk_experthandyman_featureimg2).'" class="img-responsive secondry-bg-img" />';
					}else{
						echo '<img alt="luzuk_experthandyman_featureimg2" src="'.get_template_directory_uri().'/assets/images/bann2.jpg" class="img-responsive" />';
					}
				?></li>
				<li>
					<h2><?php echo esc_html(get_theme_mod('luzuk_experthandyman_feature_servicebyprofessional')); ?></h2>
				</li>
				<li>
					<div class="icnbx"> <i class="fa-solid fa-arrow-up"></i> </div>
				</li>
			</div>

			<div class="line3">
				<li>
					<h2>
						<div class="linebrd3"></div>
						<?php echo esc_html(get_theme_mod('luzuk_experthandyman_feature_technicaldesigners')); ?>
					</h2>
				</li>
				<li><?php 
					$luzuk_experthandyman_featureimg3 = get_theme_mod('luzuk_experthandyman_feature_img3');

					if(!empty($luzuk_experthandyman_featureimg3)){
						echo '<img alt="'. esc_html(get_the_title()) .'" src="'.esc_url($luzuk_experthandyman_featureimg3).'" class="img-responsive secondry-bg-img" />';
					}else{
						echo '<img alt="luzuk_experthandyman_featureimg3" src="'.get_template_directory_uri().'/assets/images/bann3.jpg" class="img-responsive" />';
					}
				?></li>
			</div>

			<div class="line4">
				<li><h2 class="str_txt"><?php echo esc_html(get_theme_mod('luzuk_experthandyman_feature_forcomplete')); ?></h2></li>
				<li> 	
					<img alt="luzuk_experthandyman_featureimg3" src="<?php echo esc_url(get_template_directory_uri() . '/assets/images/bann4.png'); ?>" class="img-responsive" />
				</li>
				<li><h2><?php echo esc_html(get_theme_mod('luzuk_experthandyman_feature_needs')); ?></h2></li>
			</div>
		</div>
	</section>
	<?php }?>

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

	<?php if (get_theme_mod('luzuk_experthandyman_aboutus_hideshow',true)) {?>
	<section id="aboutus-section">
		<!-- <div class="overlay"></div> -->
		<div class="container"> 
			<div class="row"> 
				<div class="abt_cont">
					<div class="headigbx">
						<div class="abtbrd"></div>
						<h4 class="heading"><?php echo esc_html(get_theme_mod('luzuk_experthandyman_aboutusheading')); ?></h4>				
						<h4 class="title"><?php echo esc_html(get_theme_mod('luzuk_experthandyman_aboutustitle')); ?></h4>
					</div>
					<div class="box box1">
						<div class="row mr-0">
							<?php
								$aboutus_box1icon = esc_html(get_theme_mod('luzuk_experthandyman_aboutus_box1icon'));
							?>
							<?php if (!empty($aboutus_box1icon)): ?>
								<div class="box1ic icon">
									<i class="<?php echo esc_html(get_theme_mod('luzuk_experthandyman_aboutus_box1icon')); ?>" aria-hidden="true"></i>
								</div>
							<?php endif; ?>
							<div class="cont">
								<h3><?php echo esc_html(get_theme_mod('luzuk_experthandyman_aboutus_box1title')); ?></h3>
								<p><?php echo esc_html(get_theme_mod('luzuk_experthandyman_aboutus_box1decription')); ?></p>
							</div>
						</div>
					</div>	
					<div class="box box2">
						<div class="row mr-0">
							<?php
								$aboutus_box2icon = esc_html(get_theme_mod('luzuk_experthandyman_aboutus_box2icon'));
							?>
							<?php if (!empty($aboutus_box2icon)): ?>
								<div class="box2ic icon">
									<i class="<?php echo esc_html(get_theme_mod('luzuk_experthandyman_aboutus_box2icon')); ?>" aria-hidden="true"></i>
								</div>
							<?php endif; ?>
							<div class="cont">
								<h3><?php echo esc_html(get_theme_mod('luzuk_experthandyman_aboutus_box2title')); ?></h3>
								<p><?php echo esc_html(get_theme_mod('luzuk_experthandyman_aboutus_box2decription')); ?></p>
							</div>
						</div>
					</div>	
					<div class="box box3">
						<div class="row mr-0">
							<?php
								$aboutus_box3icon = esc_html(get_theme_mod('luzuk_experthandyman_aboutus_box3icon'));
							?>
							<?php if (!empty($aboutus_box3icon)): ?>
								<div class="box3ic icon">
									<i class="<?php echo esc_html(get_theme_mod('luzuk_experthandyman_aboutus_box3icon')); ?>" aria-hidden="true"></i>
								</div>
							<?php endif; ?>
							<div class="cont">
								<h3><?php echo esc_html(get_theme_mod('luzuk_experthandyman_aboutus_box3title')); ?></h3>
								<p><?php echo esc_html(get_theme_mod('luzuk_experthandyman_aboutus_box3decription')); ?></p>
							</div>
						</div>
					</div>				
					<div class="detailbx">
						<div class="row">
							<div class="col-lg-6 col-md-12 col-sm-12 ">
								
								<div class="aboutusphonnum">
									<div class="row mr-0">
										<div class="phonicon">
											<i class="fa fa-volume-control-phone"></i>
										</div>
										<div class="phncont">
											<h3>
												<a href="tel:<?php echo esc_html(get_theme_mod('luzuk_experthandyman_aboutus_phonenum')); ?>">
													<?php echo esc_html(get_theme_mod('luzuk_experthandyman_aboutus_phonenum')); ?>
												</a>
											</h3>
										<p><?php echo esc_html(get_theme_mod('luzuk_experthandyman_aboutus_phonnumtitle')); ?></p>
										</div>
									</div>
								</div>
							</div>
							<div class="col-lg-6 col-md-12 col-sm-12 pd-0">
								<div class="aboutusemail">
									<div class="row mr-0">
										<div class="emailicon">
											<i class="fa fa-comments" aria-hidden="true"></i>
										</div>
										<div class="emailcont">
											<h3>
												<a href="mailto:<?php echo esc_html(get_theme_mod('luzuk_experthandyman_aboutus_email')); ?>">
													<?php echo esc_html(get_theme_mod('luzuk_experthandyman_aboutus_email')); ?>
												</a>
											</h3>
											<p><?php echo esc_html(get_theme_mod('luzuk_experthandyman_aboutus_emailtitle')); ?></p>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
					<div class="bttn">
						<a class="get" href="<?php echo esc_url(get_theme_mod('luzuk_experthandyman_aboutusreadmorebtnlink')) ?>">
							<?php esc_html_e( 'Read More','expert-handyman' );?>
						</a>
					</div>
				</div>
				<div class="abt_imgbx">
					<p class="description"><?php echo esc_html(get_theme_mod('luzuk_experthandyman_aboutusdescription')); ?></p>				

					<div class="aboutus-img">
						<div class="row">
							<div class="img1">
								<?php 
									$luzuk_experthandyman_aboutus_image1 = get_theme_mod('luzuk_experthandyman_aboutus_image1');

									if(!empty($luzuk_experthandyman_aboutus_image1)){
										echo '<img alt="'. esc_html(get_the_title()) .'" src="'.esc_url($luzuk_experthandyman_aboutus_image1).'" class="img-responsive secondry-bg-img" />';
									}else{
										echo '<img alt="luzuk_experthandyman_aboutus_image1" src="'.get_template_directory_uri().'/assets/images/abt1.png" class="img-responsive" />';
									}
								?>	
							</div>
							<div class="img1txtbx">
								<div class="img1txt">
									<div class="num"><?php echo esc_html(get_theme_mod('luzuk_experthandyman_aboutus_imagebox1num')); ?></div>
									<div class="n-txt"><?php echo esc_html(get_theme_mod('luzuk_experthandyman_aboutus_imagebox1heading')); ?></div>
								</div>
							</div>
						</div>
						<div class="img2">
							<div class="img2img">
								<?php 
									$luzuk_experthandyman_aboutus_image2 = get_theme_mod('luzuk_experthandyman_aboutus_image2');

									if(!empty($luzuk_experthandyman_aboutus_image2)){
										echo '<img alt="'. esc_html(get_the_title()) .'" src="'.esc_url($luzuk_experthandyman_aboutus_image2).'" class="img-responsive secondry-bg-img" />';
									}else{
										echo '<img alt="luzuk_experthandyman_aboutus_image2" src="'.get_template_directory_uri().'/assets/images/abt1.png" class="img-responsive" />';
									}
								?>
							</div>
						</div>
						<div class="img3">
							<div class="row">
								<div class="img3bx">
								<?php 
									$luzuk_experthandyman_aboutus_image3 = get_theme_mod('luzuk_experthandyman_aboutus_image3');

									if(!empty($luzuk_experthandyman_aboutus_image3)){
										echo '<img alt="'. esc_html(get_the_title()) .'" src="'.esc_url($luzuk_experthandyman_aboutus_image3).'" class="img-responsive secondry-bg-img" />';
									}else{
										echo '<img alt="luzuk_experthandyman_aboutus_image3" src="'.get_template_directory_uri().'/assets/images/abt1.png" class="img-responsive" />';
									}
								?>
								</div>
								<div class="img3txtbx">
									<div class="img3txtbxinn">
										<div class="numtxt"><?php echo esc_html(get_theme_mod('luzuk_experthandyman_aboutus_imagebox2num')); ?></div>
										<div class="numtxt1"><?php echo esc_html(get_theme_mod('luzuk_experthandyman_aboutus_imagebox2heading1')); ?></div>
										<div class="numtxt2"><?php echo esc_html(get_theme_mod('luzuk_experthandyman_aboutus_imagebox2heading2')); ?></div>
									</div>
								</div>
							</div>
						</div>
					</div>	
				</div>
			</div>
		</div>
	</section>
	<?php }?>

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

	<?php if (get_theme_mod('luzuk_experthandyman_services_hideshow',true)) {?>
	<section id="services-section">
		<div class="headbx">
			<div class="container"> 	
				<div class="row"> 	
					<div class="col-lg-6 col-md-12 col-sm-12">
						<div class="titlebx">
							<h2 class="heading"><?php echo esc_html(get_theme_mod('luzuk_experthandyman_servicesheading')); ?>
							</h2>
							<h3 class="title"><?php echo esc_html(get_theme_mod('luzuk_experthandyman_servicestitle')); ?>
							</h3>	
							<div class="titlebrd"></div>
						</div>	
					</div>	
					<div class="col-lg-6 col-md-12 col-sm-12">
						<p><?php echo esc_html(get_theme_mod('luzuk_experthandyman_servicesdescription')); ?></p>
					</div>
				</div>	
			</div>
		</div>
		<div class="container"> 
			<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_experthandyman_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 <= 7; $i++) {
							$selected_page_id = get_theme_mod('luzuk_experthandyman_page_setting_' . $i);
							if ($selected_page_id) {
								$page = get_post($selected_page_id);

								$icon = get_theme_mod('luzuk_experthandyman_page_setting_icon' . $i);
								?>
								<div class="serbx col-lg-3 col-md-6 col-sm-12">
									<div class="serbxinn">
										<a href="<?php echo get_permalink($page->ID); ?>">
											<?php echo get_the_post_thumbnail($page->ID, 'medium'); ?>
											<div class="s_oly"></div>
										</a>
										<div class="sconbx ">
											<a href="<?php echo get_permalink($page->ID); ?>">
												<h4>
													<i class="<?php echo esc_attr($icon); ?>"></i>
													<?php echo $page->post_title; ?>
												</h4>
											</a>
										</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 }?>

	<?php do_action('luzuk_experthandyman_below_services_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(); ?>