<?php
$bosa_construction_company_page_one 	= get_theme_mod( 'bosa_construction_company_blog_grand_event_one', '' );
$bosa_construction_company_page_two 	= get_theme_mod( 'bosa_construction_company_blog_grand_event_two', '' );
$bosa_construction_company_page_three 	= get_theme_mod( 'bosa_construction_company_blog_grand_event_three', '' );
$bosa_construction_company_page_four  	= get_theme_mod( 'bosa_construction_company_blog_grand_event_four', '' );
$bosa_construction_company_page_five  	= get_theme_mod( 'bosa_construction_company_blog_grand_event_five', '');
$bosa_construction_company_page_six  	= get_theme_mod( 'bosa_construction_company_blog_grand_event_six', '');

$bosa_construction_company_page_array = array();
$bosa_construction_company_has_page = false;
$bosa_construction_company_has_array = false;

if( !empty( $bosa_construction_company_page_one ) ){
	$bosa_construction_company_has_page = true;
	$bosa_construction_company_has_array = true;
	$bosa_construction_company_page_array['page_one'] = array(
		'ID' => $bosa_construction_company_page_one,
	);
}
if( !empty( $bosa_construction_company_page_two ) ){
	$bosa_construction_company_has_page = true;
	$bosa_construction_company_has_array = true;
	$bosa_construction_company_page_array['page_two'] = array(
		'ID' => $bosa_construction_company_page_two,
	);
}
if( !empty( $bosa_construction_company_page_three ) ){
	$bosa_construction_company_has_page = true;
	$bosa_construction_company_has_array = true;
	$bosa_construction_company_page_array['page_three'] = array(
		'ID' => $bosa_construction_company_page_three,
	);
}
if( !empty( $bosa_construction_company_page_four ) ){
	$bosa_construction_company_has_page = true;
	$bosa_construction_company_has_array = true;
	$bosa_construction_company_page_array['page_four'] = array(
		'ID' => $bosa_construction_company_page_four,
	);
}
if( !empty( $bosa_construction_company_page_five ) ){
	$bosa_construction_company_has_page = true;
	$bosa_construction_company_has_array = true;
	$bosa_construction_company_page_array['page_five'] = array(
		'ID' => $bosa_construction_company_page_five,
	);
}
if( !empty( $bosa_construction_company_page_six ) ){
	$bosa_construction_company_has_page = true;
	$bosa_construction_company_has_array = true;
	$bosa_construction_company_page_array['page_six'] = array(
		'ID' => $bosa_construction_company_page_six,
	);
}

if( !get_theme_mod( 'bosa_construction_company_disable_grand_event_section', true ) && $bosa_construction_company_has_page ){ ?>
	<section class="section-grand-event-area">
		<?php if ( $bosa_construction_company_has_array ){ ?>
			<div class="row justify-content-center">
				<?php foreach( $bosa_construction_company_page_array as $bosa_construction_company_each_page ){ ?>
					<div class="col-md-6 px-lg-4">
						<article class="event-iconbox">
							<figure class="featured-image">
								<?php echo get_the_post_thumbnail( $bosa_construction_company_each_page[ 'ID' ], 'bosa-construction-company-420-380' ); ?>
							</figure>
							<div class="entry-content">
								<h4 class="entry-title">
									<a href="<?php echo esc_url( get_permalink( $bosa_construction_company_each_page[ 'ID' ] ) ); ?>">
										<?php echo esc_html( get_the_title( $bosa_construction_company_each_page[ 'ID' ] ) ); ?>
									</a>
								</h4>
								<div class="entry-text">
									<?php 
									$bosa_construction_company_excerpt = get_the_excerpt( $bosa_construction_company_each_page[ 'ID' ] );
									$bosa_construction_company_result  = wp_trim_words( $bosa_construction_company_excerpt, 10, '' );
									echo esc_html( $bosa_construction_company_result );
									?>
								</div>
								<a href="<?php echo esc_url( get_permalink( $bosa_construction_company_each_page[ 'ID' ] ) ); ?>" class="event-page-link">
									Learn More...
								</a>
							</div>
						</article>
					</div>
				<?php } ?>
			</div>
		<?php } ?>
	</section>	
<?php }