<?php
/**
 * Template Name: Custom Home
 */

get_header(); ?>

<main id="skip-content" role="main">

	<?php do_action( 'fish_aquarium_shop_above_slider' ); ?>

	<?php if( get_theme_mod('fish_aquarium_shop_slider_hide_show') != ''){ ?>
		<section id="slider">
			<div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
			    <?php $fish_aquarium_shop_slider_pages = array();
			    for ( $count = 1; $count <= 4; $count++ ) {
			        $mod = intval( get_theme_mod( 'fish_aquarium_shop_slider'. $count ));
			        if ( 'page-none-selected' != $mod ) {
			          $fish_aquarium_shop_slider_pages[] = $mod;
			        }
			    }
		      	if( !empty($fish_aquarium_shop_slider_pages) ) :
			        $args = array(
			          	'post_type' => 'page',
			          	'post__in' => $fish_aquarium_shop_slider_pages,
			          	'orderby' => 'post__in'
			        );
		        	$query = new WP_Query( $args );
		        if ( $query->have_posts() ) :
		          	$i = 1;
		    	?>     
				    <div class="carousel-inner" role="listbox">
				      	<?php  while ( $query->have_posts() ) : $query->the_post(); ?>
					        <div <?php if($i == 1){echo 'class="carousel-item fade-in-image active"';} else{ echo 'class="carousel-item fade-in-image"';}?>>
					        	<div class="sliderimg">
									<img src="<?php echo esc_url(get_the_post_thumbnail_url(get_the_ID(), 'full')); ?>" alt="<?php the_title_attribute(); ?>" />
								</div>
							    <div class="slidoly">
					                <svg class="waves" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 24 150 28" preserveAspectRatio="none" shape-rendering="auto">
					                    <defs>
					                        <path id="gentle-wave" d="M-160 65c30 0 58-18 88-18s 58 18 88 18 58-18 88-18 58 18 88 18 v44h-352z"></path>
					                    </defs>
					                    <g class="parallax">
					                        <use xlink:href="#gentle-wave" class="wave1" x="48" y="3" fill="#7960ac"></use>
					                        <use xlink:href="#gentle-wave" class="wave2" x="48" y="6" fill="#5c36a8"></use>
					                    </g>
					                </svg>
					            </div>
			        			<?php
									$fish_aquarium_shop_slider_effect = get_theme_mod('fish_aquarium_shop_slider_effect', '') 
								?>
		            			<div class="carousel-caption <?php echo ($fish_aquarium_shop_slider_effect); ?>">
						            <div class="inner-carousel">
						              	<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
										  <p class="mb-0"><?php $fish_aquarium_shop_excerpt = get_the_excerpt(); echo esc_html( fish_aquarium_shop_string_limit_words( $fish_aquarium_shop_excerpt, esc_attr(get_theme_mod('fish_aquarium_shop_slider_excerpt_length','15') ) )); ?></p>
						              	<a href="<?php the_permalink(); ?>" class="read-btn"><span><?php echo esc_html('READ MORE','fish-aquarium-shop'); ?></span><span class="screen-reader-text"><?php echo esc_html('READ MORE','fish-aquarium-shop'); ?></span></a>
				            		</div>
				            	</div>
					        </div>
				      	<?php $i++; endwhile; 
				      	wp_reset_postdata();?>
				    </div>
			    <?php else : ?>
			    	<div class="no-postfound"></div>
	      		<?php endif;
			    endif;?>
			    <a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev">
			      	<span class="carousel-control-prev-icon" aria-hidden="true"><i class="fas fa-angle-left"></i></span>
			      	<span class="screen-reader-text"><?php esc_html_e( 'Prev','fish-aquarium-shop' );?></span>
			    </a>
			    <a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next">
			      	<span class="carousel-control-next-icon" aria-hidden="true"><i class="fas fa-angle-right"></i></span>
			      	<span class="screen-reader-text"><?php esc_html_e( 'Next','fish-aquarium-shop' );?></span>
			    </a>
			</div>
		  	<div class="clearfix"></div>
		</section>
	<?php }?>
	
	<?php do_action('fish_aquarium_shop_below_slider'); ?>

	<section id="about-section" class="py-4">
		<div class="container"> 
        	<div class="row ">  
        		<?php if(get_theme_mod('fish_aquarium_shop_about_image') != '') { ?>
	          		<div class="col-lg-6 col-md-6 align-self-center">
						<div class="about-img position-relative">
							<img src="<?php echo esc_url(get_theme_mod('fish_aquarium_shop_about_image')); ?>" alt="<?php esc_attr_e('About Image', 'fish-aquarium-shop'); ?>">
						</div>
					</div>
				<?php }?>
				<div class="<?php if(get_theme_mod('fish_aquarium_shop_about_image') != '') { ?>col-lg-6 col-md-6 <?php } else {?> col-lg-12 col-md-12 <?php }?> align-self-center">
					<div class="about-content">
						<?php if(get_theme_mod('fish_aquarium_shop_section_small_title') != ''){?>
							<strong><?php echo esc_html(get_theme_mod('fish_aquarium_shop_section_small_title')); ?></strong>
						<?php }?>
						<?php if(get_theme_mod('fish_aquarium_shop_section_title') != ''){?>
				      		<h3><?php echo esc_html(get_theme_mod('fish_aquarium_shop_section_title')); ?></h3>
				      	<?php }?>
				      	<?php if(get_theme_mod('fish_aquarium_shop_section_text') != ''){?>
					      	<p><?php echo esc_html(get_theme_mod('fish_aquarium_shop_section_text')); ?></p>
				      	<?php }?>
			       	</div>
			       	<?php $fish_aquarium_shop_catData1 =  get_theme_mod('fish_aquarium_shop_category_setting');
					if($fish_aquarium_shop_catData1){ 
						$args = array(
							'post_type' => 'post',
							'category_name' => $fish_aquarium_shop_catData1,
							'posts_per_page' => get_theme_mod('fish_aquarium_shop_service_number',2)
				        );
				        $i=1; ?>
		        		<?php $query = new WP_Query( $args );
			          	if ( $query->have_posts() ) :
			        		while( $query->have_posts() ) : $query->the_post(); ?>
		          				<div class="service-box mt-3">
		          					<div class="row">
		          						<div class="col-lg-3 col-md-4 col-4 align-self-center">
		          							<div class="service-icon">
		          								<i class="<?php echo esc_attr(get_theme_mod('fish_aquarium_shop_service_icon' . $i, 'fas fa-star')); ?>"></i>
		          							</div>
		          						</div>
		          						<div class="col-lg-9 col-md-8 col-8 align-self-center">
		          							<div class="service-content">
					            				<h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
								              	<p class="mb-0"><?php $fish_aquarium_shop_excerpt = get_the_excerpt(); echo esc_html( fish_aquarium_shop_string_limit_words( $fish_aquarium_shop_excerpt,15 ) ); ?></p>
				            				</div>
		          						</div>
		          					</div>
		          				</div>
			          		<?php $i++; endwhile; 
			          		wp_reset_postdata(); ?>
			          	<?php else : ?>
			              	<div class="no-postfound"></div>
			            <?php endif; ?>
		      		<?php }?>
		      		<?php if(get_theme_mod('fish_aquarium_shop_contact_btn_text') != '' || get_theme_mod('fish_aquarium_shop_contact_btn_url') != ''){?>
				      	<div class="about-btn mt-4">
		            		<a href="<?php echo esc_url(get_theme_mod('fish_aquarium_shop_contact_btn_url')); ?>"><span><?php echo esc_html(get_theme_mod('fish_aquarium_shop_contact_btn_text')); ?></span><span class="screen-reader-text"><?php echo esc_html(get_theme_mod('fish_aquarium_shop_contact_btn_text')); ?></span></a>
				       	</div>
			       	<?php }?>
			    </div>  
          	</div>
		</div>
	</section>

	<?php do_action('fish_aquarium_shop_below_service_section'); ?>

	<div class="container">
	  	<?php while ( have_posts() ) : the_post(); ?>
	  		<div class="lz-content">
	        	<?php the_content(); ?>
	        </div>
	    <?php endwhile; // end of the loop. ?>
	</div>
</main>

<?php get_footer(); ?>