<?php
/**
 *
 */
if(get_theme_mod('lz_featured_pages_disable') != 'on' ){?>
	<section id="featured-pages-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 <= 8; $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_featured_pages_title','OUR FEATURES');
					$lz_fitness_featured_sub_title = get_theme_mod('lz_featured_pages_sub_title','Our Featured Courses are selected through a rigorous process and uniquely created for each semester.');
					?>

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

					<div class="col-md-12 padding0">
						<div class="featured-post-wrap">
							<?php
							$cols = get_theme_mod('lz_featured_pages_npp_count', 3);
							$cols++;
							$col = 1;
							switch($cols){
								case 1:
								$colCls = 'col-md-12 col-sm-12';
								break;
								case 2:
								$col = 2;
								$colCls = 'col-md-6 col-sm-6';
								break;
								case 3:
								case 5:
								case 6:
								$col = 3;
								$colCls = 'col-md-4 col-sm-6';
								break;

								case 4:
								case 7:
								case 8:
								default: 
								$col = 4;
								$colCls = 'col-md-3 col-sm-6 featured-post-content';
								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';
								$j=1;
								for( $i = 1; $i <= $cols; $i++ ){
									if( get_theme_mod('lz_featured_pages_CoursesFColor'.$i,true) ) {
										$lz_featured_pages_CoursesFColor = 'background-color:'.esc_attr(get_theme_mod('lz_featured_pages_CoursesFColor'.$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-content flipper">
															<div class="featured-post fpost wow fadeInUp text-center flip-container">
																<div class="col-md-12 front" style="<?php echo esc_attr($lz_featured_pages_CoursesFColor); ?>">
																	<div class="featured-icon">
																		<span class="<?php echo $lz_fitness_featured_page_icon; ?>"></span>
																	</div>
																	<h5><a href="<?php echo esc_url(get_permalink()); ?>"><?php the_title(); ?></a></h5>
																</div>
																<div class="col-md-12 text-center back">
																	
																	<div class="featured-excerpt">
																		<?php 
																		if(has_excerpt()){
																			echo get_the_excerpt();
																		}else{
																			echo lz_fitness_excerpt( get_the_content(), 120); 
																		}?>
																	</div>
																	<div class="featured-btn">
															<a class="btn " href="<?php echo esc_url(get_permalink()); ?>">Read More</a>
														</div>
																</div>
														
														
														<div class="clearfix"></div>
													</div>
												</div>
											</div>
											<?php
										endwhile;
									endif;	
									wp_reset_postdata();
								}
							}else{?>
								<div class="<?php echo $colCls;?>">
										<div class="featured-content flipper">
											<div class="featured-post fpost wow fadeInUp text-center flip-container">
												<div class="col-md-12 front" style="<?php echo esc_attr($lz_featured_pages_CoursesFColor); ?>">
														<div class="featured-icon"><span class="<?php echo $lz_fitness_featured_page_icon; ?> fa-graduation-cap"></span></div>
															<h5>Education</h5>

													
												</div>
												<div class="col-md-12 back">
													<div class="featured-excerpt">
														Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry standard dummy text ever since the 1500s.
													</div>
													<div class="featured-btn">
												<a class="btn" href="#"> Read More</a>
											</div>
												</div>
											
											
											<div class="clearfix"></div>
										</div>
									</div>
							</div>
							<?php 
						}
						if(($j%$col) == 0){
							echo '
							<div class="clearfix"></div>
							</div>
							<div class="row feature-post-boxes">';
						}
						++$j;

					}?>
					<div class="clearfix"></div>
				</div>
			</div>
			<div class="clearfix"></div>
		</div>
	</div>
</div>
<div class="clearfix"></div>
</div>
<div class="clearfix"></div>
</div>
</section>





<!--
<script>
	jQuery.noConflict();
	$(function(){
		function fpostHeight(){
			var ht = 0;
			$('#featured-pages-section .featured-post h5').each(function(i){
				var tHt = $(this).height();
				if(ht<tHt){
					ht=tHt;
				}
			});
			$('#featured-pages-section .featured-post h5').height(ht+'px');
		}
		fpostHeight();
	});
	$( window ).resize(function(){
		fpostHeight();
	});
</script>
<script>
	jQuery.noConflict();
	$(function(){
		function fpostHeight(){
			var ht = 0;
			$('#featured-pages-section .featured-excerpt').each(function(i){
				var tHt = $(this).height();
				if(ht<tHt){
					ht=tHt;
				}
			});
			$('#featured-pages-section .featured-excerpt').height(ht+'px');
		}
		fpostHeight();
	});
	$( window ).resize(function(){
		fpostHeight();
	});
</script>-->
<?php }



