<?php
$bosa_medical_care_blogAdvertoneID 			= get_theme_mod( 'bosa_medical_care_blog_exclusive_offers_one','');
$bosa_medical_care_blogDiscountoneLabel 	= get_theme_mod( 'bosa_medical_care_blog_offer_one_label', '');
$bosa_medical_care_blogAdverttwoID 			= get_theme_mod( 'bosa_medical_care_blog_exclusive_offers_two','');       
$bosa_medical_care_blogDiscounttwoLabel 	= get_theme_mod( 'bosa_medical_care_blog_offer_two_label', '');
$bosa_medical_care_blogAdvertthreeID 		= get_theme_mod( 'bosa_medical_care_blog_exclusive_offers_three','');
$bosa_medical_care_blogDiscountthreeLabel 	= get_theme_mod( 'bosa_medical_care_blog_offer_three_label', '');

$bosa_medical_care_Advert_array = array();
$bosa_medical_care_has_Advert = false;
$bosa_medical_care_has_label = false;
if( !empty( $bosa_medical_care_blogAdvertoneID ) || !empty( $bosa_medical_care_blogDiscountoneLabel ) ){
	$bosa_medical_care_blog_exclusive_offers_one  = wp_get_attachment_image_src( $bosa_medical_care_blogAdvertoneID,'bosa-medical-care-590-310');
 	if ( is_array(  $bosa_medical_care_blog_exclusive_offers_one ) ){
 		$bosa_medical_care_has_Advert = true;
 		$bosa_medical_care_has_label = true;
   	 	$bosa_medical_care_blog_exclusive_offerss_one = $bosa_medical_care_blog_exclusive_offers_one[0];
   	 	$bosa_medical_care_Advert_array['image_one'] = array(
			'ID' => $bosa_medical_care_blog_exclusive_offerss_one,
			'offer_label' => $bosa_medical_care_blogDiscountoneLabel,
		);	
  	}
}
if( !empty( $bosa_medical_care_blogAdverttwoID  ) || !empty( $bosa_medical_care_blogDiscounttwoLabel ) ){
	$bosa_medical_care_blog_exclusive_offers_two = wp_get_attachment_image_src( $bosa_medical_care_blogAdverttwoID,'bosa-medical-care-590-310');
	if ( is_array(  $bosa_medical_care_blog_exclusive_offers_two ) ){
		$bosa_medical_care_has_Advert = true;
		$bosa_medical_care_has_label = true;	
        $bosa_medical_care_blog_exclusive_offerss_two = $bosa_medical_care_blog_exclusive_offers_two[0];
        $bosa_medical_care_Advert_array['image_two'] = array(
			'ID' => $bosa_medical_care_blog_exclusive_offerss_two,
			'offer_label' => $bosa_medical_care_blogDiscounttwoLabel,
		);	
  	}
}
if( !empty( $bosa_medical_care_blogAdvertthreeID ) || !empty( $bosa_medical_care_blogDiscountthreeLabel )){	
	$bosa_medical_care_blog_exclusive_offers_three = wp_get_attachment_image_src( $bosa_medical_care_blogAdvertthreeID,'bosa-medical-care-590-310');
	if ( is_array(  $bosa_medical_care_blog_exclusive_offers_three ) ){
		$bosa_medical_care_has_Advert = true;
		$bosa_medical_care_has_label = true;
      	$bosa_medical_care_blog_exclusive_offerss_three = $bosa_medical_care_blog_exclusive_offers_three[0];
      	$bosa_medical_care_Advert_array['image_three'] = array(
			'ID' => $bosa_medical_care_blog_exclusive_offerss_three,
			'offer_label' => $bosa_medical_care_blogDiscountthreeLabel,
		);	
  	}
}

if( !get_theme_mod( 'bosa_medical_care_disable_exclusive_offers_section', true ) && $bosa_medical_care_has_Advert && $bosa_medical_care_has_label ){ ?>
	<section class="section-exclusive_offers-area">
		<div class="content-wrap">
			<div class="row justify-content-center">
				<?php foreach( $bosa_medical_care_Advert_array as $bosa_medical_care_each_Advert ){ ?>
					<div class="col-sm-6 col-md-4">
						<article class="exclusive_offers-content-wrap">
							<figure class= "featured-image">
								<?php if( !empty( $bosa_medical_care_each_Advert['offer_label'] ) ) { ?>
									<span class="overlay-txt">
										<?php echo esc_html( $bosa_medical_care_each_Advert['offer_label'] ); ?>
									</span>
								<?php } ?>
								<img src="<?php echo esc_url( $bosa_medical_care_each_Advert['ID'] ); ?>">
							</figure>
						</article>
					</div>
				<?php } ?>
			</div>	
		</div>
	</section>
<?php } 