<?php
$bosa_veterinary_care_page_title 	= get_theme_mod( 'bosa_veterinary_care_centerstage_event_title', '' );
$bosa_veterinary_care_page_one 	= get_theme_mod( 'bosa_veterinary_care_centerstage_event_page_one', '' );
$bosa_veterinary_care_page_two 	= get_theme_mod( 'bosa_veterinary_care_centerstage_event_page_two', '' );
$bosa_veterinary_care_page_three  = get_theme_mod( 'bosa_veterinary_care_centerstage_event_page_three', '' );
$bosa_veterinary_care_page_four   = get_theme_mod( 'bosa_veterinary_care_centerstage_event_page_four', '' );
$bosa_veterinary_care_page_five   = get_theme_mod( 'bosa_veterinary_care_centerstage_event_page_five', '');

$bosa_veterinary_care_page_array = array();
$bosa_veterinary_care_has_page = false;
$bosa_veterinary_care_has_array = false;
if( !empty( $bosa_veterinary_care_page_title ) ){
	$bosa_veterinary_care_has_page = true;
}

if( !empty( $bosa_veterinary_care_page_one ) ){
	$bosa_veterinary_care_has_page = true;
	$bosa_veterinary_care_has_array = true;
	$bosa_veterinary_care_page_array['page_one'] = array(
		'ID' => $bosa_veterinary_care_page_one,
	);
}
if( !empty( $bosa_veterinary_care_page_two ) ){
	$bosa_veterinary_care_has_page = true;
	$bosa_veterinary_care_has_array = true;
	$bosa_veterinary_care_page_array['page_two'] = array(
		'ID' => $bosa_veterinary_care_page_two,
	);
}
if( !empty( $bosa_veterinary_care_page_three ) ){
	$bosa_veterinary_care_has_page = true;
	$bosa_veterinary_care_has_array = true;
	$bosa_veterinary_care_page_array['page_three'] = array(
		'ID' => $bosa_veterinary_care_page_three,
	);
}
if( !empty( $bosa_veterinary_care_page_four ) ){
	$bosa_veterinary_care_has_page = true;
	$bosa_veterinary_care_has_array = true;
	$bosa_veterinary_care_page_array['page_four'] = array(
		'ID' => $bosa_veterinary_care_page_four,
	);
}
if( !empty( $bosa_veterinary_care_page_five ) ){
	$bosa_veterinary_care_has_page = true;
	$bosa_veterinary_care_has_array = true;
	$bosa_veterinary_care_page_array['page_five'] = array(
		'ID' => $bosa_veterinary_care_page_five,
	);
}

if( !get_theme_mod( 'bosa_veterinary_care_disable_centerstage_event_section', true ) && $bosa_veterinary_care_has_page ){ ?>
	<section class="section-centerstage-event-area">
		<?php if( !empty( $bosa_veterinary_care_page_title ) ){ ?>
			<h2 class="event-title text-center">
					<?php echo esc_html( $bosa_veterinary_care_page_title ); ?>
			</h2>
		<?php }	
		 if ( $bosa_veterinary_care_has_array ){ ?>
			<div class="row">
				<?php foreach( $bosa_veterinary_care_page_array as $bosa_veterinary_care_each_page ){ ?>
					<div class="col-12">
						<div class="event-wrapper">
							<article class="event-iconbox">
								<div class="event-icon">
									<i class="fas fa-calendar-check"></i>
								</div>
								<div class="entry-content">
									<h3 class="entry-title">
										<a href="<?php echo esc_url( get_permalink( $bosa_veterinary_care_each_page[ 'ID' ] ) ); ?>">
											<?php echo esc_html( get_the_title( $bosa_veterinary_care_each_page[ 'ID' ] ) ); ?>
										</a>
									</h3>
									<div class="entry-text">
										<?php 
										$bosa_veterinary_care_excerpt = get_the_excerpt( $bosa_veterinary_care_each_page[ 'ID' ] );
										$bosa_veterinary_care_result  = wp_trim_words( $bosa_veterinary_care_excerpt, 15, '' );
										echo esc_html( $bosa_veterinary_care_result );
										?>
									</div>
								</div>
								<a href="<?php echo esc_url( get_permalink( $bosa_veterinary_care_each_page[ 'ID' ] ) ); ?>" class="event-page-link">
									<i class="fas fa-plus"></i>
								</a>
							</article>
						</div>
					</div>
				<?php } ?>
			</div>
		<?php } ?>
	</section>	
<?php } 