<?php
$bosa_logistics_page_one 	= get_theme_mod( 'bosa_logistics_event_highlight_one', '' );
$bosa_logistics_page_two 	= get_theme_mod( 'bosa_logistics_event_highlight_two', '' );
$bosa_logistics_page_three  = get_theme_mod( 'bosa_logistics_event_highlight_three', '' );
$bosa_logistics_page_four   = get_theme_mod( 'bosa_logistics_event_highlight_four', '' );
$bosa_logistics_page_five   = get_theme_mod( 'bosa_logistics_event_highlight_five', '');

$bosa_logistics_page_array = array();
$bosa_logistics_has_array = false;
$bosa_logistics_has_page = false;
if( !empty( $bosa_logistics_page_one ) ){
	$bosa_logistics_has_page = true;	
}
if( !empty( $bosa_logistics_page_two ) ){
	$bosa_logistics_has_page = true;
	$bosa_logistics_has_array = true;
	$bosa_logistics_page_array['page_two'] = array(
		'ID' => $bosa_logistics_page_two,
	);
}
if( !empty( $bosa_logistics_page_three ) ){
	$bosa_logistics_has_page = true;
	$bosa_logistics_has_array = true;
	$bosa_logistics_page_array['page_three'] = array(
		'ID' => $bosa_logistics_page_three,
	);
}
if( !empty( $bosa_logistics_page_four ) ){
	$bosa_logistics_has_page = true;
	$bosa_logistics_has_array = true;
	$bosa_logistics_page_array['page_four'] = array(
		'ID' => $bosa_logistics_page_four,
	);
}
if( !empty( $bosa_logistics_page_five ) ){
	$bosa_logistics_has_page = true;
	$bosa_logistics_has_array = true;
	$bosa_logistics_page_array['page_five'] = array(
		'ID' => $bosa_logistics_page_five,
	);
}

if( !get_theme_mod( 'bosa_logistics_disable_event_highlights_section', true ) && $bosa_logistics_has_page ){ ?>
	<section class="highlights-event-area">
		<?php 
		if( !empty( $bosa_logistics_page_one ) ){ ?>
			<div class="section-title-wrap text-center">
				<h2 class="event-section-title">
					<a href="<?php echo esc_url( get_permalink( $bosa_logistics_page_one ) ); ?>">
						<?php echo esc_html( get_the_title( $bosa_logistics_page_one ) ); ?>
					</a>
				</h2>
				<p>
					<?php 
					$bosa_logistics_excerpt = get_the_excerpt( $bosa_logistics_page_one );
					$bosa_logistics_result  = wp_trim_words( $bosa_logistics_excerpt, 10, '' );
					echo esc_html( $bosa_logistics_result );?>	
				</p>
			</div>
			<?php 
		}
		if ( $bosa_logistics_has_array ){ ?>
			<div class="row events-row">
				<?php foreach( $bosa_logistics_page_array as $bosa_logistics_each_page ){ ?>
					<div class="col-md-6 px-lg-4">
						<article class="event-iconbox">
							<div class="event-icon">
								<i class="fa-solid fa-truck-fast"></i>
							</div>
							<div class="entry-content">
								<h3 class="entry-title">
									<a href="<?php echo esc_url( get_permalink( $bosa_logistics_each_page[ 'ID' ] ) ); ?>">
										<?php echo esc_html( get_the_title( $bosa_logistics_each_page[ 'ID' ] ) ); ?>
									</a>
								</h3>
								<div class="entry-text">
									<?php 
									$bosa_logistics_excerpt = get_the_excerpt( $bosa_logistics_each_page[ 'ID' ] );
									$bosa_logistics_result  = wp_trim_words( $bosa_logistics_excerpt, 10, '' );
									echo esc_html( $bosa_logistics_result );
									?>
								</div>
							</div>
						</article>
					</div>
				<?php } ?>
			</div>
		<?php } ?>
	</section>	
<?php }