<?php
/**
 *
 * @package Luzuk Premium
 */
if(get_theme_mod('gallery_section_disable') != 'on' ){ 
	?>
	<div class="container">
		<?php 
	if( get_theme_mod('sec_gallerysectionTpadding',true) ) {
		$sec_gallerysectionTpadding = 'padding-top:'.esc_attr(get_theme_mod('sec_gallerysectionTpadding')).';';
	}
	if( get_theme_mod('sec_gallerysectionBpadding',true) ) {
		$sec_gallerysectionBpadding = 'padding-bottom:'.esc_attr(get_theme_mod('sec_gallerysectionBpadding')).';';
	}
	if( get_theme_mod('sec_gallerysectionImgOverlayOp',true) ) {
		$sec_gallerysectionImgOverlayOp = 'opacity:'.esc_attr(get_theme_mod('sec_gallerysectionImgOverlayOp')).';';
	}
	?>	
<div class="gallery-area" id="gallery">
	
	<?php			
		$gallery_maintitle = get_theme_mod('gallery_maintitle', 'Our Gallery');
		$gallery_text = get_theme_mod('gallery_text', 'Lorem ipsum dolor sit amet');
			?>
		
			<div class="row justify-content-center bg-pd textcenter" style="<?php echo esc_attr($gallery_areaTpadding); ?>">
				<div class="section-title">
					<?php if($gallery_maintitle){ ?> 
						<h2><?php echo ($gallery_maintitle);?></h2>
					<?php }?>
					<?php if($gallery_text){ ?>
						<p><?php echo ($gallery_text);  ?></p>
					<?php }?>
				</div>						
			</div>

		
			<div class="row">

				<?php 
				$showStatic = true;
				$cols = get_theme_mod('gallery_npp_count', 5);
				$cols++;
				switch($cols){
					case 1:
						$colCls = 'col-md-12 col-sm-12';
						break;
					case 2:
						$colCls = 'col-md-6 col-sm-6';
						break;
					default: 
						$colCls = 'col-md-3 col-sm-6';
						break;
				}
				for( $i = 1; $i <= $cols; $i++ ){
					$gallery_page_id = get_theme_mod('gallery_page'.$i); 
					$gallery_page_icon = get_theme_mod('gallery_page_icon'.$i);
					if($gallery_page_id){
						$showStatic = false;
						echo galleryShortCode($gallery_page_id, $isCustomizer=true, $i);
					}
				}

				$args = array(
				  'post_type' => 'our-gallery',
				  'post_status' => 'publish'
				);
				$new = new WP_Query($args); 
				$i=1;
				if($showStatic == true){
		          while ( $new->have_posts() ){
		          	$new->the_post(); 
		          	$thumb = wp_get_attachment_image_src( get_post_thumbnail_id(get_the_ID()), 'medium_large' );
		      		if(has_post_thumbnail()) { $thumb_url = $thumb['0']; }
	      			$url = $thumb['0'];?>
					<div class="col-md-2 col-sm-6 col-xs-12 gallery-box">
					<div class="lz-gallery-images innergallery wow zoomIn ">
						
						 <a class="group1 ginerborder" href="<?php echo esc_url($thumb_url); ?>" title="<?php the_title(); ?>">
						  <img class="secondry-bg img-responsive" src="<?php echo esc_url($thumb_url); ?>" alt="<?php the_title(); ?>" />
							 <ul class="gallery-icon">
	                            <li>
	                               <i class="fa fa-camera" ></i>
	                            </li>
	                        </ul>
						</a>
					</div>


					</div>
					<?php 
					$i++; } wp_reset_query();
				} ?>

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

