<?php
/**
 *
 * @package Luzuk Premium
 */
if(get_theme_mod('lz_fitness_featured_section_disable') != 'on' ){?>
<section id="featured-post-section" class="ht-section">
	<div class="lightbox">
		<div class="container">
			<div class="wow fadeInUp" data-wow-duration="1s">
				<?php
				$showStatic = true;
				for( $i = 1; $i < 11; $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 FEATURES');
				//$lz_fitness_featured_sub_title = get_theme_mod('lz_fitness_featured_sub_title', 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.');
				?>
				<div class="row">
						<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>
						<!--	<div class="ht-section-tagline lz-featured-text">
								<?php //if($lz_fitness_featured_sub_title){
									//echo esc_html($lz_fitness_featured_sub_title);
								//}?>
							</div>
						</div>-->
					<div class="clearfix"></div>
				</div>
				<div class="row">
						<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-6 col-sm-6';
								break;
								case 4:
								case 8:
								case 7:
								case 10:
								case 11:
								case 12:
								$colCls = 'col-md-3 col-sm-6';
								break;

								default: 
								$colCls = 'col-md-4 col-sm-6';
								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
								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 text-center">
															<div class="featured-icon">
																<img src="<?php echo esc_url($lz_fitness_featured_page_icon); ?>" class="img-responcive" />
															</div>
															<h5><?php the_title(); ?></h5>
															<div class="featured-excerpt">
																<?php 
																if(has_excerpt()){
																	echo get_the_excerpt();
																}else{
																	echo lz_fitness_excerpt( get_the_content(), 90); 
																}?>
															</div>
															<div class="featured-link">
																<a href="<?php echo esc_url(get_permalink()); ?>"><?php _e( 'Read More', 'total' ); ?></a>
															</div>
															<div class="clearfix"></div>
														</div>
													</div>
													<?php
												endwhile;
											endif;	
											wp_reset_postdata();
										}
									}else{?>
										<div class="<?php echo $colCls;?>">
											<div class="featured-post text-center">
												<div class="featured-icon">
												<img src="<?php echo esc_html(get_template_directory_uri()); ?>/images/nothumb-featured.png" class="img-responcive" />
												</div>
												
													<h5>Sample Page</h5>
													<div class="featured-excerpt">
														Lorem ipsum dolor amet, constetuer adipiscing elit, sed diam...
													</div>												
													<div class="featured-link">
														<a href="#"><?php _e( 'Read More', 'lz-fitness' ); ?></a>
													</div>
													<div class="clearfix"></div>												
											</div>
										</div>
									<?php }

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