<?php
$bosa_media_marketing_page_one 	= get_theme_mod( 'bosa_media_marketing_blog_memorable_moments_page_one', '' );
$bosa_media_marketing_page_two 	= get_theme_mod( 'bosa_media_marketing_blog_memorable_moments_page_two', '' );
$bosa_media_marketing_page_three = get_theme_mod( 'bosa_media_marketing_blog_memorable_moments_page_three', '' );
$bosa_media_marketing_page_four  = get_theme_mod( 'bosa_media_marketing_blog_memorable_moments_page_four', '' );

$bosa_media_marketing_page_array = array();
$bosa_media_marketing_has_page = false;
$bosa_media_marketing_has_array = false;
if( !empty( $bosa_media_marketing_page_one ) ){
	$bosa_media_marketing_has_page = true;	
}
if( !empty( $bosa_media_marketing_page_two ) ){
	$bosa_media_marketing_has_page = true;
	$bosa_media_marketing_has_array = true;
	$bosa_media_marketing_page_array['page_two'] = array(
		'ID' => $bosa_media_marketing_page_two,
	);
}
if( !empty( $bosa_media_marketing_page_three ) ){
	$bosa_media_marketing_has_page = true;
	$bosa_media_marketing_has_array = true;
	$bosa_media_marketing_page_array['page_three'] = array(
		'ID' => $bosa_media_marketing_page_three,
	);
}
if( !empty( $bosa_media_marketing_page_four ) ){
	$bosa_media_marketing_has_page = true;
	$bosa_media_marketing_has_array = true;
	$bosa_media_marketing_page_array['page_four'] = array(
		'ID' => $bosa_media_marketing_page_four,
	);
}

if( !get_theme_mod( 'bosa_media_marketing_disable_memorable_moments_section', true ) && $bosa_media_marketing_has_page ){ ?>
	<section class="section-memorable-moments-area">
		<?php if( !empty( $bosa_media_marketing_page_one ) ){ ?>
			<div class="section-title-wrap text-center">
				<h2 class="memorable-section-title">
					<a href="<?php echo esc_url( get_permalink( $bosa_media_marketing_page_one ) ); ?>">
						<?php echo esc_html( get_the_title( $bosa_media_marketing_page_one ) ); ?>
					</a>
				</h2>
				<p>
					<?php 
					$bosa_media_marketing_excerpt = get_the_excerpt( $bosa_media_marketing_page_one );
					$bosa_media_marketing_result  = wp_trim_words( $bosa_media_marketing_excerpt, 10, '' );
					echo esc_html( $bosa_media_marketing_result );?>	
				</p>
			</div>
		<?php }
		if ( $bosa_media_marketing_has_array ){ ?>
			<div class="row justify-content-center">
				<?php foreach( $bosa_media_marketing_page_array as $bosa_media_marketing_each_page ){ ?>
					<div class="col-lg-4 col-sm-6 px-4">
						<div class="event-wrapper">
							<article class="event-iconbox">
								<div class="patten-overlay">
									<i class="fas fa-braille"></i>
								</div>
								<div class="patten-overlay-bottom">
									<i class="fas fa-braille"></i>
								</div>
								<div class="event-icon">
									<i class="far fa-calendar-check"></i>
								</div>
								<div class="entry-content">
									<h3 class="entry-title">
										<a href="<?php echo esc_url( get_permalink( $bosa_media_marketing_each_page[ 'ID' ] ) ); ?>">
											<?php echo esc_html( get_the_title( $bosa_media_marketing_each_page[ 'ID' ] ) ); ?>
										</a>
									</h3>
									<div class="entry-text">
										<?php 
										$bosa_media_marketing_excerpt = get_the_excerpt( $bosa_media_marketing_each_page[ 'ID' ] );
										$bosa_media_marketing_result  = wp_trim_words( $bosa_media_marketing_excerpt, 10, '' );
										echo esc_html( $bosa_media_marketing_result );
										?>
									</div>
								</div>
								<div class="event-link-wrap">
									<a href="<?php echo esc_url( get_permalink( $bosa_media_marketing_each_page[ 'ID' ] ) ); ?>" class="event-page-link">
										<i class="fas fa-plus"></i>
									</a>
								</div>
							</article>
						</div>
					</div>
				<?php } ?>
			</div>
		<?php } ?>
	</section>	
<?php } ?>