<?php
$bosa_courier_service_page_one 	= get_theme_mod( 'bosa_courier_service_services_page_one', '' );
$bosa_courier_service_page_two 	= get_theme_mod( 'bosa_courier_service_services_page_two', '' );
$bosa_courier_service_page_three = get_theme_mod( 'bosa_courier_service_services_page_three', '' );
$bosa_courier_service_page_four  = get_theme_mod( 'bosa_courier_service_services_page_four', '' );
$bosa_courier_service_page_five  = get_theme_mod( 'bosa_courier_service_services_page_five', '');
$bosa_courier_service_page_six  	= get_theme_mod( 'bosa_courier_service_services_page_six', '');

$bosa_courier_service_page_array = array();
$bosa_courier_service_has_page = false;
$bosa_courier_service_has_array = false;

if( !empty( $bosa_courier_service_page_one ) ){
	$bosa_courier_service_has_page = true;
	$bosa_courier_service_has_array = true;
	$bosa_courier_service_page_array['page_one'] = array(
		'ID' => $bosa_courier_service_page_one,
	);
}
if( !empty( $bosa_courier_service_page_two ) ){
	$bosa_courier_service_has_page = true;
	$bosa_courier_service_has_array = true;
	$bosa_courier_service_page_array['page_two'] = array(
		'ID' => $bosa_courier_service_page_two,
	);
}
if( !empty( $bosa_courier_service_page_three ) ){
	$bosa_courier_service_has_page = true;
	$bosa_courier_service_has_array = true;
	$bosa_courier_service_page_array['page_three'] = array(
		'ID' => $bosa_courier_service_page_three,
	);
}
if( !empty( $bosa_courier_service_page_four ) ){
	$bosa_courier_service_has_page = true;
	$bosa_courier_service_has_array = true;
	$bosa_courier_service_page_array['page_four'] = array(
		'ID' => $bosa_courier_service_page_four,
	);
}
if( !empty( $bosa_courier_service_page_five ) ){
	$bosa_courier_service_has_page = true;
	$bosa_courier_service_has_array = true;
	$bosa_courier_service_page_array['page_five'] = array(
		'ID' => $bosa_courier_service_page_five,
	);
}
if( !empty( $bosa_courier_service_page_six ) ){
	$bosa_courier_service_has_page = true;
	$bosa_courier_service_has_array = true;
	$bosa_courier_service_page_array['page_six'] = array(
		'ID' => $bosa_courier_service_page_six,
	);
}

if( !get_theme_mod( 'bosa_courier_service_disable_services_section', true ) && $bosa_courier_service_has_page ){ ?>
	<section class="section-services-area">
		<?php
		if ( $bosa_courier_service_has_array ){ ?>
			<div class="row justify-content-center">
				<?php foreach( $bosa_courier_service_page_array as $bosa_courier_service_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_courier_service_each_page[ 'ID' ], 'bosa-courier-service-420-380' ); ?>
							</figure>
							<div class="entry-content">
								<h4 class="entry-title">
									<a href="<?php echo esc_url( get_permalink( $bosa_courier_service_each_page[ 'ID' ] ) ); ?>">
										<?php echo esc_html( get_the_title( $bosa_courier_service_each_page[ 'ID' ] ) ); ?>
									</a>
								</h4>
								<div class="entry-text">
									<?php 
									$bosa_courier_service_excerpt = get_the_excerpt( $bosa_courier_service_each_page[ 'ID' ] );
									$bosa_courier_service_result  = wp_trim_words( $bosa_courier_service_excerpt, 15, '' );
									echo esc_html( $bosa_courier_service_result );
									?>
								</div>
								<a href="<?php echo esc_url( get_permalink( $bosa_courier_service_each_page[ 'ID' ] ) ); ?>" class="event-page-link">
									<?php echo esc_html__('Learn More...', 'bosa-courier-service');?>
								</a>
							</div>
						</article>
					</div>
				<?php } ?>
			</div>
		<?php } ?>
	</section>	
<?php }