<?php
$bosa_interior_design_page_one 	= get_theme_mod( 'bosa_interior_design_blog_grand_event_page_one', '' );
$bosa_interior_design_page_two 	= get_theme_mod( 'bosa_interior_design_blog_grand_event_page_two', '' );
$bosa_interior_design_page_three = get_theme_mod( 'bosa_interior_design_blog_grand_event_page_three', '' );
$bosa_interior_design_page_four  = get_theme_mod( 'bosa_interior_design_blog_grand_event_page_four', '' );
$bosa_interior_design_page_five  = get_theme_mod( 'bosa_interior_design_blog_grand_event_page_five', '');

$bosa_interior_design_page_array = array();
$bosa_interior_design_has_page = false;
$bosa_interior_design_has_array = false;
if( !empty( $bosa_interior_design_page_one ) ){
	$bosa_interior_design_has_page = true;	
}
if( !empty( $bosa_interior_design_page_two ) ){
	$bosa_interior_design_has_page = true;
	$bosa_interior_design_has_array = true;
	$bosa_interior_design_page_array['page_two'] = array(
		'ID' => $bosa_interior_design_page_two,
	);
}
if( !empty( $bosa_interior_design_page_three ) ){
	$bosa_interior_design_has_page = true;
	$bosa_interior_design_has_array = true;
	$bosa_interior_design_page_array['page_three'] = array(
		'ID' => $bosa_interior_design_page_three,
	);
}
if( !empty( $bosa_interior_design_page_four ) ){
	$bosa_interior_design_has_page = true;
	$bosa_interior_design_has_array = true;
	$bosa_interior_design_page_array['page_four'] = array(
		'ID' => $bosa_interior_design_page_four,
	);
}
if( !empty( $bosa_interior_design_page_five ) ){
	$bosa_interior_design_has_page = true;
	$bosa_interior_design_has_array = true;
	$bosa_interior_design_page_array['page_five'] = array(
		'ID' => $bosa_interior_design_page_five,
	);
}

if( !get_theme_mod( 'bosa_interior_design_disable_grand_event_section', true ) && $bosa_interior_design_has_page ){ ?>
	<section class="section-grand-event-area">
		<?php if( !empty( $bosa_interior_design_page_one ) ){ ?>
			<div class="section-title-wrap text-center col-lg-6 offset-lg-3 col-md-8 offset-md-2">
				<h2 class="event-section-title">
					<a href="<?php echo esc_url( get_permalink( $bosa_interior_design_page_one ) ); ?>">
						<?php echo esc_html( get_the_title( $bosa_interior_design_page_one ) ); ?>
					</a>
				</h2>
				<p>
					<?php 
					$bosa_interior_design_excerpt = get_the_excerpt( $bosa_interior_design_page_one );
					$bosa_interior_design_result  = wp_trim_words( $bosa_interior_design_excerpt, 20, '' );
					echo esc_html( $bosa_interior_design_result );?>	
				</p>
			</div>
		<?php }
		if ( $bosa_interior_design_has_array ){ ?>
			<div class="row justify-content-center">
				<?php foreach( $bosa_interior_design_page_array as $bosa_interior_design_each_page ){ ?>
					<div class="col-sm-6">
						<div class="event-wrapper">
							<article class="event-iconbox">
								<figure class="featured-image">
									<?php echo get_the_post_thumbnail( $bosa_interior_design_each_page[ 'ID' ], 'bosa-interior-design-1370-550' ); ?>
								</figure>
								<div class="entry-content">
									<h3 class="entry-title">
										<a href="<?php echo esc_url( get_permalink( $bosa_interior_design_each_page[ 'ID' ] ) ); ?>">
											<?php echo esc_html( get_the_title( $bosa_interior_design_each_page[ 'ID' ] ) ); ?>
										</a>
									</h3>
									<div class="entry-text">
										<?php 
										$bosa_interior_design_excerpt = get_the_excerpt( $bosa_interior_design_each_page[ 'ID' ] );
										$bosa_interior_design_result  = wp_trim_words( $bosa_interior_design_excerpt, 10, '' );
										echo esc_html( $bosa_interior_design_result );
										?>
									</div>
									<a href="<?php echo esc_url( get_permalink( $bosa_interior_design_each_page[ 'ID' ] ) ); ?>" class="event-page-link">
										Learn More...
									</a>
								</div>
							</article>
						</div>
					</div>
				<?php } ?>
			</div>
		<?php } ?>
	</section>	
<?php }