<?php  

if(get_theme_mod('gallery_section_disable') != 'on' ){ ?>  
	<?php 
		if( get_theme_mod('secgalleryTpadding',true) ) {
			$secgalleryTpadding = 'padding-top:'.esc_attr(get_theme_mod('secgalleryTpadding')).';';
		}
		if( get_theme_mod('secgalleryBpadding',true) ) {
			$secgalleryBpadding = 'padding-bottom:'.esc_attr(get_theme_mod('secgalleryBpadding')).';';
		}

	?>	

	<section id="gallery" class="area-inner" style="<?php echo esc_attr($secgalleryTpadding); ?>" "<?php echo esc_attr($secgalleryBpadding); ?>">
		<?php
			$gall_maintitle = get_theme_mod('gall_maintitle', 'OUR GALLERY');
			$gall_subtitle = get_theme_mod('gall_subtitle', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Quis ipsum suspendisse ultrices gravida. Risus commodo viverra maecenas accumsan lacus vel facilisis.');
		?>
		<?php if( get_theme_mod('Gally_img_display','show' ) == 'show') : ?> 
			<div class="Gallydotlhs">
					<?php 
						$Gallydotlhs_image = get_theme_mod('Gallydotlhs_image');
						if(!empty($Gallydotlhs_image)){
							echo '<img alt="'. esc_html(get_the_title()) .'" src="'.esc_url($Gallydotlhs_image).'" class="img-responsive" />';
						}else{
							echo '<img alt="Gallydotlhs_image" src="'.get_template_directory_uri().'/images/Dotted-S2.png" class="img-responsive" />';
						}
					?>
			</div>
		<?php endif ?>
		<div class="container">
			<div class="row justify-content-center">
			<?php if($gall_maintitle || $gall_subtitle){ ?>
				<div class="col-md-10 col-md-offset2">
			      <div class="section-heading">
			          <h2><?php echo ($gall_maintitle);  ?></h2>
			          <p><?php echo ($gall_subtitle);  ?></p>
			      </div>
				</div>
			<?php }?>
			</div>
		</div>
		<div class="container">
		<?php
			$gallery_page_id = get_theme_mod('gallery_page');	
		?>
			<div class="gallery-main-box">
				<!-- <div class="row"> -->
					<!-- <div class="ht-team-member-wrap ht-clearfix"> -->
						<?php 
						$showStatic = true;
						$cols = get_theme_mod('gallery_npp_count', 7);
						$cols++;
						switch($cols){
						case 1:
						$colCls = 'col-md-12 col-sm-12';
						break;
						case 2:	
						$colCls = 'col-md-6 col-sm-6';
						break;
						case 3:
						case 5:
						case 6:
						case 9:
						case 11:
						$colCls = 'col-md-4 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="<?php echo $colCls; ?> wow zoomIn pd-0 spa-gallimg">
								<div class="lz-gallery-images">
									<figure class="spa-gall">
										
									<a data-fancybox="gallery" 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(); ?>" />
											<!-- <h4><?php the_title(); ?></h4> -->
										 <i class="fa fa-plus"></i> 
										<div class="clearfix"></div>
									</a>
									</figure>
								</div>
							</div> 
							<?php 
							$i++; } wp_reset_query();
						} ?>

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

