<?php
/**
 *
 */
if(get_theme_mod('lz_fitness_featured_section_disable') != 'on' ){?>
<section id="featured-post-section" class="ht-section">
	<div class="lightbox">
		<div class="col-md-10 col-md-offset-1">
			<div class="row">
				<?php
				$showStatic = true;
				for( $i = 1; $i < 4; $i++ ){
					$lz_fitness_featured_page_id = get_theme_mod('lz_fitness_featured_page'.$i); 
					if(!empty($lz_fitness_featured_page_id)){
						$showStatic = false;
						break;
					}
				}
				$lz_fitness_featured_title = get_theme_mod('lz_fitness_featured_title', 'OUR Services');
				$lz_fitness_featured_sub_title = get_theme_mod('lz_fitness_featured_sub_title', 'CHOOSE YOUR DESIRED COURSE');
				?>

				<div class="ht-section-title-tagline">
					<h2 class="ht-section-title lz-featured-heading">
						<?php
						if(!empty($lz_fitness_featured_title))	{
							echo esc_html($lz_fitness_featured_title);
						} ?>
					</h2>
					<div class="ht-section-tagline lz-featured-text feature-border">
						<?php if($lz_fitness_featured_sub_title){
							echo esc_html($lz_fitness_featured_sub_title);
						}?>
					</div>
				</div>
						
				<div class="col-md-7 padding0">
						

						<div class="featured-post-wrap">
							<?php
							$cols = get_theme_mod('lz_fitness_featured_npp_count', 3);
							$cols++;
							// echo '$cold: '.$cols;
							switch($cols){
								case 1:
								$colCls = 'col-md-12 col-sm-12';
								break;
								case 2:
								$colCls = 'col-md-12 col-sm-12';
								break;

								case 4:
								$colCls = 'col-md-12 col-sm-12';
								break;

								default: 
								$colCls = 'col-md-12 col-sm-12';
								break;
							}
							$icons = array(1=>'heart', 2=>'star', 3=>'flash', 4=>'bell',5=>'heart', 6=>'star', 7=>'flash', 8=>'bell');
							?>
							<div class="row feature-post-boxes">
								<?php
								$lz_fitness_featured_page_icon = 'fa fa-bell';
								for( $i = 1; $i <= $cols; $i++ ){
									if($showStatic === false){
										$lz_fitness_featured_page_id = get_theme_mod('lz_fitness_featured_page'.$i); 
										$lz_fitness_featured_page_icon = get_theme_mod('lz_fitness_featured_page_icon'.$i);
										
										if($lz_fitness_featured_page_id){
											$args = array( 
												'page_id' => absint($lz_fitness_featured_page_id) 
											);
											$query = new WP_Query($args);
											if( $query->have_posts() ):
												while($query->have_posts()) : $query->the_post();
													?>
													<div class="<?php echo $colCls;?>">
														<div class="featured-post wow fadeInUp">
															<div class="col-md-2">
															<div class="featured-icon">
																<span class="<?php echo $lz_fitness_featured_page_icon; ?>"></span>
															</div>
															</div>
															<div class="col-md-10">
															<h5><a href="<?php echo esc_url(get_permalink()); ?>"><?php the_title(); ?></a></h5>
															<div class="featured-excerpt">
																<?php 
															if(has_excerpt()){
																echo get_the_excerpt();
															}else{
																echo lz_fitness_excerpt( get_the_content(), 150); 
															}?>
															</div>
															</div>
															<div class="clearfix"></div>
														</div>
													</div>
													
													<?php
												endwhile;
											endif;	
											wp_reset_postdata();
										}
									}else{?>
										<div class="<?php echo $colCls;?>">
											<div class="featured-post wow fadeInUp">
												<div class="col-md-2">
												<div class="featured-icon"><span class="<?php echo $lz_fitness_featured_page_icon; ?>"></span></div>
												</div>
												<div class="col-md-10">
												<h5>Online Training</h5>
												<div class="featured-excerpt">
													Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla a Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla a
												</div>
												</div>
												<div class="clearfix"></div>
											</div>
										</div>
									<?php }

								}?>
								<div class="clearfix"></div>
							</div>
						</div>
					<div class="clearfix"></div>
				</div>
				
				<div class="col-md-5 left-img padding0"> 
				<?php 
				$lz_fitness_featured_image = get_theme_mod('lz_fitness_featured_image'); 
				if(!empty($lz_fitness_featured_image)){ echo '<img alt="'. esc_html(get_the_title()) .'" src="'.esc_url($lz_fitness_featured_image).'" class="img-responsive img-rounded"/>'; }
				else{ 
					echo '<img alt="featured" src="'.get_template_directory_uri().'/images/feature-img.png" class="baseline img-responsive" />'; 
					} 
				?> 
				</div>
				
				
			</div>
			<div class="clearfix"></div>
		</div>
		<div class="clearfix"></div>
	</div>
</section>
<?php }