<?php
$bosa_driving_school_blogOffersoneID = get_theme_mod( 'bosa_driving_school_blog_exclusive_offers_one','');
$bosa_driving_school_blogDiscountoneLabel = get_theme_mod( 'bosa_driving_school_blog_offer_one_label', '');
$bosa_driving_school_blogOfferstwoID = get_theme_mod( 'bosa_driving_school_blog_exclusive_offers_two','');       
$bosa_driving_school_blogDiscounttwoLabel = get_theme_mod( 'bosa_driving_school_blog_offer_two_label', '');
$bosa_driving_school_blogOffersthreeID = get_theme_mod( 'bosa_driving_school_blog_exclusive_offers_three','');
$bosa_driving_school_blogDiscountthreeLabel = get_theme_mod( 'bosa_driving_school_blog_offer_three_label', '');
$bosa_driving_school_blogOffersfourID = get_theme_mod( 'bosa_driving_school_blog_exclusive_offers_four','');
$bosa_driving_school_blogDiscountfourLabel = get_theme_mod( 'bosa_driving_school_blog_offer_four_label', '');

$bosa_driving_school_Offers_array = array();
$bosa_driving_school_has_Offers = false;
$bosa_driving_school_has_label = false;
if( !empty( $bosa_driving_school_blogOffersoneID ) || !empty( $bosa_driving_school_blogDiscountoneLabel ) ){
	$bosa_driving_school_blog_exclusive_offers_one  = wp_get_attachment_image_src( $bosa_driving_school_blogOffersoneID,'bosa-driving-school-590-310');
 	if ( is_array(  $bosa_driving_school_blog_exclusive_offers_one ) ){
 		$bosa_driving_school_has_Offers = true;
 		$bosa_driving_school_has_label = true;
   	 	$bosa_driving_school_blog_exclusive_offerss_one = $bosa_driving_school_blog_exclusive_offers_one[0];
   	 	$bosa_driving_school_Offers_array['image_one'] = array(
			'ID' => $bosa_driving_school_blog_exclusive_offerss_one,
			'offer_label' => $bosa_driving_school_blogDiscountoneLabel,
		);	
  	}
}
if( !empty( $bosa_driving_school_blogOfferstwoID  ) || !empty( $bosa_driving_school_blogDiscounttwoLabel ) ){
	$bosa_driving_school_blog_exclusive_offers_two = wp_get_attachment_image_src( $bosa_driving_school_blogOfferstwoID,'bosa-driving-school-590-310');
	if ( is_array(  $bosa_driving_school_blog_exclusive_offers_two ) ){
		$bosa_driving_school_has_Offers = true;
		$bosa_driving_school_has_label = true;	
        $bosa_driving_school_blog_exclusive_offerss_two = $bosa_driving_school_blog_exclusive_offers_two[0];
        $bosa_driving_school_Offers_array['image_two'] = array(
			'ID' => $bosa_driving_school_blog_exclusive_offerss_two,
			'offer_label' => $bosa_driving_school_blogDiscounttwoLabel,
		);	
  	}
}
if( !empty( $bosa_driving_school_blogOffersthreeID ) || !empty( $bosa_driving_school_blogDiscountthreeLabel )){	
	$bosa_driving_school_blog_exclusive_offers_three = wp_get_attachment_image_src( $bosa_driving_school_blogOffersthreeID,'bosa-driving-school-590-310');
	if ( is_array(  $bosa_driving_school_blog_exclusive_offers_three ) ){
		$bosa_driving_school_has_Offers = true;
		$bosa_driving_school_has_label = true;
      	$bosa_driving_school_blog_exclusive_offerss_three = $bosa_driving_school_blog_exclusive_offers_three[0];
      	$bosa_driving_school_Offers_array['image_three'] = array(
			'ID' => $bosa_driving_school_blog_exclusive_offerss_three,
			'offer_label' => $bosa_driving_school_blogDiscountthreeLabel,
		);	
  	}
}

if( !empty( $bosa_driving_school_blogOffersfourID ) || !empty( $bosa_driving_school_blogDiscountthreeLabel )){	
	$bosa_driving_school_blog_exclusive_offers_four = wp_get_attachment_image_src( $bosa_driving_school_blogOffersfourID,'bosa-driving-school-590-310');
	if ( is_array(  $bosa_driving_school_blog_exclusive_offers_four ) ){
		$bosa_driving_school_has_Offers = true;
		$bosa_driving_school_has_label = true;
      	$bosa_driving_school_blog_exclusive_offerss_four = $bosa_driving_school_blog_exclusive_offers_four[0];
      	$bosa_driving_school_Offers_array['image_four'] = array(
			'ID' => $bosa_driving_school_blog_exclusive_offerss_four,
			'offer_label' => $bosa_driving_school_blogDiscountfourLabel,
		);	
  	}
}

if( !get_theme_mod( 'bosa_driving_school_disable_exclusive_offers_section', true ) && $bosa_driving_school_has_Offers && $bosa_driving_school_has_label ){ ?>
	<section class="section-exclusive_offers-area">
		<div class="content-wrap">
			<div class="row justify-content-center">
				<?php foreach( $bosa_driving_school_Offers_array as $bosa_driving_school_each_Offers ){ ?>
					<div class="col-sm-6 col-lg-3">
						<article class="exclusive_offers-content-wrap">
							<figure class= "featured-image">
								<?php if( !empty( $bosa_driving_school_each_Offers['offer_label'] ) ) { ?>
									<span class="overlay-txt">
										<?php echo esc_html( $bosa_driving_school_each_Offers['offer_label'] ); ?>
									</span>
								<?php } ?>
								<img src="<?php echo esc_url( $bosa_driving_school_each_Offers['ID'] ); ?>">
							</figure>
						</article>
					</div>
				<?php } ?>
			</div>	
		</div>
	</section>
<?php } 