<?php
$bosa_real_estate_group_blogAdvertoneID = get_theme_mod( 'bosa_real_estate_group_blog_exclusive_offers_one','');
$bosa_real_estate_group_blogDiscountoneLabel = get_theme_mod( 'bosa_real_estate_group_blog_offer_one_label', '');
$bosa_real_estate_group_blogAdverttwoID = get_theme_mod( 'bosa_real_estate_group_blog_exclusive_offers_two','');       
$bosa_real_estate_group_blogDiscounttwoLabel = get_theme_mod( 'bosa_real_estate_group_blog_offer_two_label', '');
$bosa_real_estate_group_blogAdvertthreeID = get_theme_mod( 'bosa_real_estate_group_blog_exclusive_offers_three','');
$bosa_real_estate_group_blogDiscountthreeLabel = get_theme_mod( 'bosa_real_estate_group_blog_offer_three_label', '');

$bosa_real_estate_group_Advert_array = array();
$bosa_real_estate_group_has_Advert = false;
$bosa_real_estate_group_has_label = false;
if( !empty( $bosa_real_estate_group_blogAdvertoneID ) || !empty( $bosa_real_estate_group_blogDiscountoneLabel ) ){
	$bosa_real_estate_group_blog_exclusive_offers_one  = wp_get_attachment_image_src( $bosa_real_estate_group_blogAdvertoneID,'bosa-real-estate-group-590-310');
 	if ( is_array(  $bosa_real_estate_group_blog_exclusive_offers_one ) ){
 		$bosa_real_estate_group_has_Advert = true;
 		$bosa_real_estate_group_has_label = true;
   	 	$bosa_real_estate_group_blog_exclusive_offerss_one = $bosa_real_estate_group_blog_exclusive_offers_one[0];
   	 	$bosa_real_estate_group_Advert_array['image_one'] = array(
			'ID' => $bosa_real_estate_group_blog_exclusive_offerss_one,
			'offer_label' => $bosa_real_estate_group_blogDiscountoneLabel,
		);	
  	}
}
if( !empty( $bosa_real_estate_group_blogAdverttwoID  ) || !empty( $bosa_real_estate_group_blogDiscounttwoLabel ) ){
	$bosa_real_estate_group_blog_exclusive_offers_two = wp_get_attachment_image_src( $bosa_real_estate_group_blogAdverttwoID,'bosa-real-estate-group-590-310');
	if ( is_array(  $bosa_real_estate_group_blog_exclusive_offers_two ) ){
		$bosa_real_estate_group_has_Advert = true;
		$bosa_real_estate_group_has_label = true;	
        $bosa_real_estate_group_blog_exclusive_offerss_two = $bosa_real_estate_group_blog_exclusive_offers_two[0];
        $bosa_real_estate_group_Advert_array['image_two'] = array(
			'ID' => $bosa_real_estate_group_blog_exclusive_offerss_two,
			'offer_label' => $bosa_real_estate_group_blogDiscounttwoLabel,
		);	
  	}
}
if( !empty( $bosa_real_estate_group_blogAdvertthreeID ) || !empty( $bosa_real_estate_group_blogDiscountthreeLabel )){	
	$bosa_real_estate_group_blog_exclusive_offers_three = wp_get_attachment_image_src( $bosa_real_estate_group_blogAdvertthreeID,'bosa-real-estate-group-590-310');
	if ( is_array(  $bosa_real_estate_group_blog_exclusive_offers_three ) ){
		$bosa_real_estate_group_has_Advert = true;
		$bosa_real_estate_group_has_label = true;
      	$bosa_real_estate_group_blog_exclusive_offerss_three = $bosa_real_estate_group_blog_exclusive_offers_three[0];
      	$bosa_real_estate_group_Advert_array['image_three'] = array(
			'ID' => $bosa_real_estate_group_blog_exclusive_offerss_three,
			'offer_label' => $bosa_real_estate_group_blogDiscountthreeLabel,
		);	
  	}
}

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