<?php
$bosa_veterinary_care_blogcouponimageoneID = get_theme_mod( 'bosa_veterinary_care_blog_coupon_image_one','');
$bosa_veterinary_care_blogcouponimagetwoID = get_theme_mod( 'bosa_veterinary_care_blog_coupon_image_two','');       
$bosa_veterinary_care_blogcouponimagethreeID = get_theme_mod( 'bosa_veterinary_care_blog_coupon_image_three','');
$bosa_veterinary_care_blogcouponimagefourID = get_theme_mod( 'bosa_veterinary_care_blog_coupon_image_four','');
$bosa_veterinary_care_blogcouponimagefiveID = get_theme_mod( 'bosa_veterinary_care_blog_coupon_image_five','');
$bosa_veterinary_care_blogcouponimagesixID = get_theme_mod( 'bosa_veterinary_care_blog_coupon_image_six','');
$bosa_veterinary_care_blogcoupononeID = get_theme_mod( 'bosa_veterinary_care_blog_coupon_one','');
$bosa_veterinary_care_blogcoupontwoID = get_theme_mod( 'bosa_veterinary_care_blog_coupon_two','');
$bosa_veterinary_care_blogcouponthreeID = get_theme_mod( 'bosa_veterinary_care_blog_coupon_three','');
$bosa_veterinary_care_blogcouponfourID = get_theme_mod( 'bosa_veterinary_care_blog_coupon_four','');
$bosa_veterinary_care_blogcouponfiveID = get_theme_mod( 'bosa_veterinary_care_blog_coupon_five','');
$bosa_veterinary_care_blogcouponsixID = get_theme_mod( 'bosa_veterinary_care_blog_coupon_six','');
 
$bosa_veterinary_care_coupons_array = array();
$bosa_veterinary_care_has_coupon_img = false;
$bosa_veterinary_care_has_coupon_txt = false;
if( !empty( $bosa_veterinary_care_blogcouponimageoneID ) ){
	$bosa_veterinary_care_blog_coupon_one  = wp_get_attachment_image_src( $bosa_veterinary_care_blogcouponimageoneID,'bosa-veterinary-care-420-300');
 	if ( is_array(  $bosa_veterinary_care_blog_coupon_one ) ){
 		$bosa_veterinary_care_has_coupon_img = true;
 		$bosa_veterinary_care_has_coupon_txt = true;
   	 	$bosa_veterinary_care_blog_coupons_one = $bosa_veterinary_care_blog_coupon_one[0];
   	 	$bosa_veterinary_care_coupons_array['image_one'] = array(
			'ID' => $bosa_veterinary_care_blog_coupons_one,
			'txt' => $bosa_veterinary_care_blogcoupononeID,
		);	
  	}
}
if( !empty( $bosa_veterinary_care_blogcouponimagetwoID ) ){
	$bosa_veterinary_care_blog_coupon_two = wp_get_attachment_image_src( $bosa_veterinary_care_blogcouponimagetwoID,'bosa-veterinary-care-420-300');
	if ( is_array(  $bosa_veterinary_care_blog_coupon_two ) ){
		$bosa_veterinary_care_has_coupon_img = true;
		$bosa_veterinary_care_has_coupon_txt = true;	
        $bosa_veterinary_care_blog_coupons_two = $bosa_veterinary_care_blog_coupon_two[0];
        $bosa_veterinary_care_coupons_array['image_two'] = array(
			'ID' => $bosa_veterinary_care_blog_coupons_two,
			'txt' => $bosa_veterinary_care_blogcoupontwoID,
		);	
  	}
}
if( !empty( $bosa_veterinary_care_blogcouponimagethreeID ) ){	
	$bosa_veterinary_care_blog_coupon_three = wp_get_attachment_image_src( $bosa_veterinary_care_blogcouponimagethreeID,'bosa-veterinary-care-420-300');
	if ( is_array(  $bosa_veterinary_care_blog_coupon_three ) ){
		$bosa_veterinary_care_has_coupon_img = true;
		$bosa_veterinary_care_has_coupon_txt = true;
      	$bosa_veterinary_care_blog_coupons_three = $bosa_veterinary_care_blog_coupon_three[0];
      	$bosa_veterinary_care_coupons_array['image_three'] = array(
			'ID' => $bosa_veterinary_care_blog_coupons_three,
			'txt' => $bosa_veterinary_care_blogcouponthreeID,
		);	
  	}
}
if( !empty( $bosa_veterinary_care_blogcouponimagefourID ) ){	
	$bosa_veterinary_care_blog_coupon_four = wp_get_attachment_image_src( $bosa_veterinary_care_blogcouponimagefourID,'bosa-veterinary-care-420-300');
	if ( is_array(  $bosa_veterinary_care_blog_coupon_four ) ){
		$bosa_veterinary_care_has_coupon_img = true;
		$bosa_veterinary_care_has_coupon_txt = true;
      	$bosa_veterinary_care_blog_coupons_four = $bosa_veterinary_care_blog_coupon_four[0];
      	$bosa_veterinary_care_coupons_array['image_four'] = array(
			'ID' => $bosa_veterinary_care_blog_coupons_four,
			'txt' => $bosa_veterinary_care_blogcouponfourID,
		);	
  	}
}
if( !empty( $bosa_veterinary_care_blogcouponimagefiveID ) ){	
	$bosa_veterinary_care_blog_coupon_five = wp_get_attachment_image_src( $bosa_veterinary_care_blogcouponimagefiveID,'bosa-veterinary-care-420-300');
	if ( is_array(  $bosa_veterinary_care_blog_coupon_five ) ){
		$bosa_veterinary_care_has_coupon_img = true;
		$bosa_veterinary_care_has_coupon_txt = true;
      	$bosa_veterinary_care_blog_coupons_five = $bosa_veterinary_care_blog_coupon_five[0];
      	$bosa_veterinary_care_coupons_array['image_five'] = array(
			'ID' => $bosa_veterinary_care_blog_coupons_five,
			'txt' => $bosa_veterinary_care_blogcouponfiveID,
		);	
  	}
}
if( !empty( $bosa_veterinary_care_blogcouponimagesixID ) ){	
	$bosa_veterinary_care_blog_coupon_six = wp_get_attachment_image_src( $bosa_veterinary_care_blogcouponimagesixID,'bosa-veterinary-care-420-300');
	if ( is_array(  $bosa_veterinary_care_blog_coupon_six ) ){
		$bosa_veterinary_care_has_coupon_img = true;
		$bosa_veterinary_care_has_coupon_txt = true;
      	$bosa_veterinary_care_blog_coupons_six = $bosa_veterinary_care_blog_coupon_six[0];
      	$bosa_veterinary_care_coupons_array['image_six'] = array(
			'ID' => $bosa_veterinary_care_blog_coupons_six,
			'txt' => $bosa_veterinary_care_blogcouponsixID,
		);	
  	}
}

if( !get_theme_mod( 'bosa_veterinary_care_disable_coupon_section', true ) && $bosa_veterinary_care_has_coupon_img && $bosa_veterinary_care_has_coupon_txt ){ ?>
	<section class="coupon-section">
		<div class="row">
			<?php foreach( $bosa_veterinary_care_coupons_array as $bosa_veterinary_care_each_coupons ){ ?>
				<div class="col-md-4 col-sm-6">
					<article class="coupon-content-wrap">
						<figure class= "featured-image">
							<img src="<?php echo esc_url( $bosa_veterinary_care_each_coupons['ID'] ); ?>">
						</figure>
						<?php if( !empty( $bosa_veterinary_care_each_coupons['txt'] ) ) { ?>
							<div class="coupon-txt">
								<?php
									echo esc_html( $bosa_veterinary_care_each_coupons['txt'] );
								?>
							</div>
						<?php } ?>
					</article>
				</div>
			<?php } ?>
		</div>	
	</section>
<?php } 