<?php
$bosa_travel_agency_page_one 	= get_theme_mod( 'bosa_travel_agency_faculties_one', '' );
$bosa_travel_agency_page_two 	= get_theme_mod( 'bosa_travel_agency_faculties_two', '' );
$bosa_travel_agency_page_three = get_theme_mod( 'bosa_travel_agency_faculties_three', '' );
$bosa_travel_agency_page_four  = get_theme_mod( 'bosa_travel_agency_faculties_four', '' );
$bosa_travel_agency_page_five  = get_theme_mod( 'bosa_travel_agency_faculties_five', '');

$bosa_travel_agency_page_array = array();
$bosa_travel_agency_has_page = false;
$bosa_travel_agency_has_array = false;

if( !empty( $bosa_travel_agency_page_one ) ){
	$bosa_travel_agency_has_page = true;
	$bosa_travel_agency_has_array = true;
	$bosa_travel_agency_page_array['page_one'] = array(
		'ID' => $bosa_travel_agency_page_one,
	);
}
if( !empty( $bosa_travel_agency_page_two ) ){
	$bosa_travel_agency_has_page = true;
	$bosa_travel_agency_has_array = true;
	$bosa_travel_agency_page_array['page_two'] = array(
		'ID' => $bosa_travel_agency_page_two,
	);
}
if( !empty( $bosa_travel_agency_page_three ) ){
	$bosa_travel_agency_has_page = true;
	$bosa_travel_agency_has_array = true;
	$bosa_travel_agency_page_array['page_three'] = array(
		'ID' => $bosa_travel_agency_page_three,
	);
}
if( !empty( $bosa_travel_agency_page_four ) ){
	$bosa_travel_agency_has_page = true;
	$bosa_travel_agency_has_array = true;
	$bosa_travel_agency_page_array['page_four'] = array(
		'ID' => $bosa_travel_agency_page_four,
	);
}
if( !empty( $bosa_travel_agency_page_five ) ){
	$bosa_travel_agency_has_page = true;
	$bosa_travel_agency_has_array = true;
	$bosa_travel_agency_page_array['page_five'] = array(
		'ID' => $bosa_travel_agency_page_five,
	);
}

if( !get_theme_mod( 'bosa_travel_agency_disable_faculties_section', true ) && $bosa_travel_agency_has_page ){ ?>
	<section class="section-faculties-area">
		<?php
		if ( $bosa_travel_agency_has_array ){ ?>			
			<?php foreach( $bosa_travel_agency_page_array as $bosa_travel_agency_each_page ){ ?>			
				<div class="faculties-wrapper">
					<figure class="featured-image">
						<?php echo get_the_post_thumbnail( $bosa_travel_agency_each_page[ 'ID' ], 'bosa-travel-agency-1370-550' ); ?>
					</figure>
					<div class="faculties-iconbox">
							<h3 class="entry-title">
								<a href="<?php echo esc_url( get_permalink( $bosa_travel_agency_each_page[ 'ID' ] ) ); ?>">
									<?php echo esc_html( get_the_title( $bosa_travel_agency_each_page[ 'ID' ] ) ); ?>
								</a>
							</h3>
							<div class="entry-text">
								<?php 
								$bosa_travel_agency_excerpt = get_the_excerpt( $bosa_travel_agency_each_page[ 'ID' ] );
								$bosa_travel_agency_result  = wp_trim_words( $bosa_travel_agency_excerpt, 15, '' );
								echo esc_html( $bosa_travel_agency_result );
								?>
							</div>
							<a href="<?php echo esc_url( get_permalink( $bosa_travel_agency_each_page[ 'ID' ] ) ); ?>" class="faculties-page-link">
								Learn More ....
							</a>
					</div>
				</div>			
			<?php } ?>		
		<?php } ?>
	</section>	
<?php }