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

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

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

	<?php if( get_theme_mod('luzuk_free_business_slider_hide_show') != ''){ ?>
	<section id="slider">	  
		
			<div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
			    <?php $luzuk_free_business_slider_pages = array();
			    for ( $count = 1; $count <= 4; $count++ ) {
			        $mod = intval( get_theme_mod( 'luzuk_free_business_slider'. $count ));
			        if ( 'page-none-selected' != $mod ) {
			          $luzuk_free_business_slider_pages[] = $mod;
			        }
			    }
		      	if( !empty($luzuk_free_business_slider_pages) ) :
			        $args = array(
			          	'post_type' => 'page',
			          	'post__in' => $luzuk_free_business_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="row mr-0">					
								<div class="content">
									<div class="cir"></div>
									<h5><?php echo esc_html(get_theme_mod('luzuk_free_business_slidersubheading', 'FOR BUSINESSES')); ?></h5> 
									<h2> <?php the_title(); ?> </h2>
									<?php 
										$luzuk_free_business_slider_excerpt_length = get_theme_mod('luzuk_free_business_slider_excerpt_length','15');
									
										if( $luzuk_free_business_slider_excerpt_length != ''){?>
										<p ><?php $luzuk_free_business_excerpt = get_the_excerpt(); echo esc_html( luzuk_free_business_string_limit_words( $luzuk_free_business_excerpt, esc_attr(get_theme_mod('luzuk_free_business_slider_excerpt_length','15') ) )); ?></p>
									<?php } ?>
									<div class="trustedbusiness">
										<div class="row mr-0">
											<h4><?php echo esc_html(get_theme_mod('luzuk_free_business_slider_businessnummber', '200+')); ?></h4> 
											<p><?php echo esc_html(get_theme_mod('luzuk_free_business_slider_businesstext', 'Join 200+ business who are accelerated their growth with our proven methodology and expert team.')); ?></p>
										</div>
									</div>
									<div class="sbtn" >
										<div class="sbtn1" >
											<a href="<?php echo esc_url(get_theme_mod('luzuk_free_business_sliderbtnlink', '#')); ?>">
												<div class="sbtn1inn" >
													<?php echo esc_html(get_theme_mod('luzuk_free_business_sliderbtntext', 'Start Your Transformation')); ?>
												</div>
											</a>
										</div>
										<div class="sbtn2" >
											<a href="<?php echo esc_url(get_theme_mod('luzuk_free_business_sliderbtn2link', '#')); ?>">
												<?php echo esc_html(get_theme_mod('luzuk_free_business_sliderbtn2text', 'See Our Work')); ?>
											</a>
										</div>
									</div>
									<div class="cir2"></div>
								</div>
								<div class="slideimg">
	                                <?php
	                                $image_url = get_the_post_thumbnail_url(get_the_ID(), 'full');
	                                if ($image_url) {
	                                    ?>
	                                    <img src="<?php echo esc_url($image_url); ?>" alt="<?php the_title_attribute(); ?>" />
	                                    <?php
	                                } else {
	                                    ?>
	                                    <img src="<?php echo esc_url(get_template_directory_uri() . '/assets/images/default.png'); ?>" alt="Default Image" />
	                                    <?php
	                                }
	                                ?>
	                                <div class="slider-overlay"></div>
	                            </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-chevron-left"></i>
			      	</span>
			      	<span class="screen-reader-text"><?php esc_html_e( 'Prev','free-business' );?></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-chevron-right"></i>
			      	</span>
			      	<span class="screen-reader-text"><?php esc_html_e( 'Next','free-business' );?></span>
			    </a>
			</div>
		  	<div class="clearfix"></div>
		</div> 
	</section>
	<?php }?>
	
	<?php do_action('luzuk_free_business_below_slider'); ?>

	<section id="aboutus-section">
        <div class="container-fluid">
            <div class="aboutus-flex">
				<div class="leftside">
					<div class="sub-title">
						<h6><?php echo esc_html(get_theme_mod('luzuk_free_business_aboutusheading', 'About')); ?></h6>
					</div>
				</div>

				<div class="rightside">
					<div class="rbx">
						<div class="titlebx">
							<div class="title">
								<h5><?php echo esc_html(get_theme_mod('luzuk_free_business_aboutustitle', 'Our Journey & Core Values')); ?></h5>
							</div>

							<div class="description">
								<p><?php echo esc_html(get_theme_mod('luzuk_free_business_aboutusdescription', 'We started with a simple mission -- to create meaningfull solutions that empower people and drive change. What began as a small team with big dreams has grown into a company built on trust, passion and innovation.')); ?></p>
							</div>
						</div>

						<div class=" row">
							<div class="box box1 col-lg-4 col-md-4 col-sm-6">
								<div class="icnbx">
									<i class="<?php echo esc_html(get_theme_mod('luzuk_free_business_aboutus_box1_icon', 'fas fa-handshake')); ?>"></i>
								</div>
								<h2><?php echo esc_html(get_theme_mod('luzuk_free_business_aboutus_box1_heading', 'Innovation')); ?></h2>
								<p><?php echo esc_html(get_theme_mod('luzuk_free_business_aboutus_box1_description', 'We Constantly challenge the norm to build smarter and better solutions.')); ?></p>
							</div>
							<div class="box box2 col-lg-4 col-md-4 col-sm-6">
								<div class="icnbx">
									<i class="<?php echo esc_html(get_theme_mod('luzuk_free_business_aboutus_box2_icon', 'fas fa-handshake')); ?>"></i>
								</div>
								<h2><?php echo esc_html(get_theme_mod('luzuk_free_business_aboutus_box2_heading', 'Integrity')); ?></h2>
								<p><?php echo esc_html(get_theme_mod('luzuk_free_business_aboutus_box2_description', 'Honestly and transparency are at the heart of everything we do.')); ?></p>
							</div>
							<div class="box box3 col-lg-4 col-md-4 col-sm-6">
								<div class="icnbx">
									<i class="<?php echo esc_html(get_theme_mod('luzuk_free_business_aboutus_box3_icon', 'fas fa-handshake')); ?>"></i>
								</div>
								<h2><?php echo esc_html(get_theme_mod('luzuk_free_business_aboutus_box3_heading', 'Collaboration')); ?></h2>
								<p><?php echo esc_html(get_theme_mod('luzuk_free_business_aboutus_box3_description', 'We believe in growing together through teamwork and shared purpose.')); ?></p>
							</div>
						</div>
						
						<div class="clearfix"> </div>
						<div class="bttn">
							<a href="<?php echo esc_url(get_theme_mod('luzuk_free_business_aboutusbtnlink', '#')); ?>">
								<?php echo esc_html(get_theme_mod('luzuk_free_business_aboutusbtntext', 'More About Us')); ?>
							</a>
						</div>
					</div>
				</div>
			</div>
		</div>
	</section>
	
	<?php do_action('luzuk_free_business_below_aboutus_section'); ?>

	<section id="services-section">
		<div class="container-fluid"> 
			<div class="services-flex">
				<div class="leftside ">		
					<div class=" headbx">		
						<h4 >
							<?php echo esc_html(get_theme_mod('luzuk_free_business_servicesheading', 'SERVICES')); ?>
						</h4>
					</div>				
				</div>
				<div class="rightside ">
					<div class="content">
						<h2 class="title"><?php echo esc_html(get_theme_mod('luzuk_free_business_servicestitle', 'What We Offer')); ?></h2>				

						<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_free_business_page_setting_' . $i);
								if ($selected_page_id) {
									$pages_selected = true;
									break;
								}
							}

							// 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_free_business_page_setting_' . $i);
									if ($selected_page_id) {
										$page = get_post($selected_page_id);
										?>
										<!-- <div class="item"> -->
										<div class="mainserbx">
											<div class="serbx">			
												<a href="<?php echo get_permalink($page->ID); ?>">
													<?php echo get_the_post_thumbnail($page->ID, 'medium'); ?>
												</a>
												<a href="<?php echo get_permalink($page->ID); ?>">
													<h4><?php echo $page->post_title; ?></h4>
												</a>
												<p><?php echo get_the_excerpt($page->ID); ?></p>
												<div class="ser-btn">							
													<a href="<?php echo get_permalink($page->ID); ?>">
														<?php _e('Learn More', 'free-business'); ?>
													</a>			
												</div>						
											</div>
										</div>

									<?php }
								}
							} else {
								// Display message if no pages are selected
								echo '<p>Please select pages from the customizer</p>';
							}
							?>
						</div>
					</div>
				</div>
			</div>
		</div>
	</section>

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

	<section id="process-section">
		<div class="container-fluid"> 
			<div class="row process-flex">
				<div class="col-lg-6 col-md-6 col-sm-12 leftside ">		
					<div class=" headbx">		
						<h4>
							<?php echo esc_html(get_theme_mod('luzuk_free_business_processheading', 'PROCESS')); ?>
						</h4>
						<h2 class="title"><?php echo esc_html(get_theme_mod('luzuk_free_business_processtitle', 'What We Offer')); ?></h2>				
						<p class="description"><?php echo esc_html(get_theme_mod('luzuk_free_business_processdescription', 'We started with a simple mission -- to create meaningfull solutions that empower people and drive change. What began as a small team with big dreams has grown into a company built on trust, passion and innovation.')); ?></p>
						<img src="<?php echo esc_url(get_template_directory_uri() . '/assets/images/ser2.jpg'); ?>" alt="Default Image" />
					</div>
				</div>
				<div class="col-lg-6 col-md-6 col-sm-12 rightside ">
					<div class="content">
						<div class="row mr-0">
							<div class="card-list">
							<?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_free_business_process_page_setting_' . $i);
								if ($selected_page_id) {
									$pages_selected = true;
									break;
								}
							}

							// 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_free_business_process_page_setting_' . $i);
									if ($selected_page_id) {
										$page = get_post($selected_page_id);
										?>
										<!-- <div class="item"> -->
										<div class="mainserbx">
											<div class="serbx">			
												<a href="<?php echo get_permalink($page->ID); ?>">
													<?php
													// Agar thumbnail hai to use icon dikhaye
														if ( has_post_thumbnail($page->ID) ) {
															echo '<i class="fas fa-image"></i>'; // ya koi aur icon
														}
													?>
												</a>
												<a href="<?php echo get_permalink($page->ID); ?>">
													<h4><?php echo $page->post_title; ?></h4>
												</a>
												<p><?php echo wp_trim_words( get_the_excerpt($page->ID), 30, '...' ); ?></p>
												<div class="ser-btn">							
													<a href="<?php echo get_permalink($page->ID); ?>">
														<?php _e('Learn More', 'free-business'); ?>
													</a>			
												</div>						
											</div>
										</div>

									<?php }
								}
							} else {
								// Display message if no pages are selected
								echo '<p>Please select pages from the customizer</p>';
							}
							?>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</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(); ?>