<?php
$bosa_finance_consult_page_one 		= get_theme_mod( 'bosa_finance_consult_service_page_one', '' );
$bosa_finance_consult_page_two 		= get_theme_mod( 'bosa_finance_consult_service_page_two', '' );
$bosa_finance_consult_page_three		= get_theme_mod( 'bosa_finance_consult_service_page_three', '' );
$bosa_finance_consult_page_four  	= get_theme_mod( 'bosa_finance_consult_service_page_four', '' );
$bosa_finance_consult_page_five  	= get_theme_mod( 'bosa_finance_consult_service_page_five', '' );

$bosa_finance_consult_page_array = array();
$bosa_finance_consult_has_page = false;
if( !empty( $bosa_finance_consult_page_one ) ){
	$bosa_finance_consult_has_page = true;
	$bosa_finance_consult_page_array['page_one'] = array(
		'ID' => $bosa_finance_consult_page_one,
	);
}
if( !empty( $bosa_finance_consult_page_two ) ){
	$bosa_finance_consult_has_page = true;
	$bosa_finance_consult_page_array['page_two'] = array(
		'ID' => $bosa_finance_consult_page_two,
	);
}
if( !empty( $bosa_finance_consult_page_three ) ){
	$bosa_finance_consult_has_page = true;
	$bosa_finance_consult_page_array['page_three'] = array(
		'ID' => $bosa_finance_consult_page_three,
	);
}
if( !empty( $bosa_finance_consult_page_four ) ){
	$bosa_finance_consult_has_page = true;
	$bosa_finance_consult_page_array['page_four'] = array(
		'ID' => $bosa_finance_consult_page_four,
	);
}
if( !empty( $bosa_finance_consult_page_five ) ){
	$bosa_finance_consult_has_page = true;
	$bosa_finance_consult_page_array['page_five'] = array(
		'ID' => $bosa_finance_consult_page_five,
	);
}

if( !get_theme_mod( 'bosa_finance_consult_disable_service_section', true ) && $bosa_finance_consult_has_page ){ ?>
	<section class="section-services-area">
		<div class="content-wrap">
			<?php foreach( $bosa_finance_consult_page_array as $bosa_finance_consult_each_page ){ ?>
				<article class="services-content-wrap">
					<figure class="featured-image">
						<?php echo get_the_post_thumbnail( $bosa_finance_consult_each_page[ 'ID' ], 'bosa-finance-consult-1370-550' ); ?>
					</figure>
					
					<div class="entry-content">
						<h3 class="entry-title">
							<a href="<?php echo esc_url( get_permalink( $bosa_finance_consult_each_page[ 'ID' ] ) ); ?>">
								<?php echo esc_html( get_the_title( $bosa_finance_consult_each_page[ 'ID' ] ) ); ?>
							</a>
						</h3>
						<div class="entry-text">
							<?php 
							$bosa_finance_consult_excerpt = get_the_excerpt( $bosa_finance_consult_each_page[ 'ID' ] );
							$bosa_finance_consult_result  = wp_trim_words( $bosa_finance_consult_excerpt, 18, '' );
							echo esc_html( $bosa_finance_consult_result );
							?>
						</div>
						<a href="<?php echo esc_url( get_permalink( $bosa_finance_consult_each_page[ 'ID' ] ) ); ?>" class="entry-button-text">
							<?php echo esc_html__( 'Continue reading', 'bosa-finance-consult' ); ?>
							<i class="fas fa-arrow-right"></i>
						</a>
					</div>
				</article>
			<?php } ?>
		</div>
	</section>
<?php }