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

get_header(); ?>

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

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

	<?php if( get_theme_mod('musicians_slider_hide_show') != ''){ ?>
		<section id="slider">

			<div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
				<?php $musicians_slider_pages = array();
				for ( $count = 1; $count <= 4; $count++ ) {
					$mod = intval( get_theme_mod( 'musicians_slider'. $count ));
					if ( 'page-none-selected' != $mod ) {
					$musicians_slider_pages[] = $mod;
					}
				}
				if( !empty($musicians_slider_pages) ) :
					$args = array(
						'post_type' => 'page',
						'post__in' => $musicians_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="row "> -->
								<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="cont-cir"></div>
								<?php
									$musicians_slider_effect = get_theme_mod('musicians_slider_effect', '') 
								?>
								<div class="content">
									<!-- <h2></?php the_title(); ?></h2> -->

									<div class="text-effect animated <?php echo ($musicians_slider_effect); ?>">
										<?php the_title(); ?>
										<span><?php $musicians_excerpt = get_the_excerpt(); echo esc_html( musicians_string_limit_words( $musicians_excerpt,1 ) ); ?></span>
									</div>

								</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="fa fa-angle-left"></i></span>
					<span class="screen-reader-text"><?php esc_html_e( 'Prev','musicians' );?></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="fa fa-angle-right"></i></span>
					<span class="screen-reader-text"><?php esc_html_e( 'Next','musicians' );?></span>
				</a>
			</div>
			<div class="clearfix"></div>
		
		</section>
	<?php }?>

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

	<?php if(get_theme_mod('musicians_section_titleservice') != '' || get_theme_mod('musicians_category_settingfeature') != ''){?>

	<section id="feature-section">
		<div class="container"> 
			<div class="feature-bx"> 
				<div class="col-xl-5 wow fadeInDown feature-head ">
					<?php if(get_theme_mod('musicians_section_titleservice') != ''){?>
						<h3><?php echo esc_html(get_theme_mod('musicians_section_titleservice')); ?></h3>
						<p><?php echo esc_html(get_theme_mod('musicians_section_subtitleservice')); ?></p>
					<?php }?>
				</div>
				<div class="row mrg-0">
					<?php $musicians_catData1 = get_theme_mod('musicians_category_settingfeature');
					if($musicians_catData1){ 
						$args = array(
							'post_type' => 'post',
							'category_name' => $musicians_catData1,
							'posts_per_page' => get_theme_mod('musicians_features_number',4)
						);
						$i=1; ?>
						<?php $query = new WP_Query( $args );
						if ( $query->have_posts() ) :
							while( $query->have_posts() ) : $query->the_post(); ?>
					<div class="col-lg-3 col-md-3 col-sm-6 featuresbx">
						<div class="feature-box">
							<div class="feature-icon">
								<i class="<?php echo esc_attr(get_theme_mod('musicians_feature_icon' . $i, 'fa fa-music')); ?>"></i>
							</div>
							<div class="feature-img">
								<?php the_post_thumbnail(); ?>
								<div class="feature-content">
									<a href="<?php the_permalink(); ?>"><h4><?php the_title(); ?></h4></a>
									
								</div>
							</div>
							
						</div>
					</div>
					<?php $i++; endwhile; 
							wp_reset_postdata(); ?>
						<?php else : ?>
					<div class="no-postfound"></div>
						<?php endif; ?>
					<?php }?>
				</div>
			</div>
		</div>
	</section>

	<?php }?>

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

	<?php if(get_theme_mod('musicians_section_title') != '' || get_theme_mod('musicians_category_setting') != ''){?>

		<section id="service-section">
			<div class="container"> 
	        	<div class="col-xl-5 wow fadeInDown service-head ">
					<?php if(get_theme_mod('musicians_section_title') != ''){?>
			      		<h3><?php echo esc_html(get_theme_mod('musicians_section_title')); ?></h3>
			      	<?php }?>
					  <p><?php echo esc_html(get_theme_mod('musicians_section_subtitle')); ?></p>
		       	</div>
		       	<div class="row">
			       	<?php $musicians_catData1 = get_theme_mod('musicians_category_setting');
					if($musicians_catData1){ 
						$args = array(
							'post_type' => 'post',
							'category_name' => $musicians_catData1,
				        );
				        $i=1; ?>
			    		<?php $query = new WP_Query( $args );
			          	if ( $query->have_posts() ) :
			        		while( $query->have_posts() ) : $query->the_post(); ?>
			        			<div class="col-lg-4 col-md-6">
				      				<div class="service-box mb-4">
				      					<a href="<?php the_permalink(); ?>">
				      						<div class="img-bx">
				      					<div class="service-img">
				      						<?php the_post_thumbnail(); ?>
				      						<div class="s-oly"></div>

				      					</div>
				      				</div>
			  							</a>
			  							<div class="service-content">
				            				<a href="<?php the_permalink(); ?>"><h4><?php the_title(); ?></h4></a>
											<p>
												<?php $musicians_excerpt = get_the_excerpt(); echo esc_html( musicians_string_limit_words( $musicians_excerpt,30 ) ); ?> <?php esc_html_e('...', 'musicians'); ?>
											</p>
											<div class="Rbtn">
											<a  href="<?php the_permalink(); ?>"><?php esc_html_e('Read More', 'musicians'); ?><span class="screen-reader-text"><?php esc_html_e('Read More', 'musicians'); ?></span></a>	
											</div>					
										</div>
				      				</div>
				      			</div>
			          		<?php $i++; endwhile; 
			          		wp_reset_postdata(); ?>
			          	<?php else : ?>
			              	<div class="no-postfound"></div>
			            <?php endif; ?>
			  		<?php }?>
			  	</div>
			</div>
		</section>

	<?php }?>

	<?php do_action('musicians_below_service_section'); ?>
</main>

<?php get_footer(); ?>