<?php
$bosa_resort_blogcodeoneID 		= get_theme_mod( 'bosa_resort_blog_code_one','');
$bosa_resort_blogcodetwoID 		= get_theme_mod( 'bosa_resort_blog_code_two','');       
$bosa_resort_blogcodethreeID 	= get_theme_mod( 'bosa_resort_blog_code_three','');
$bosa_resort_blogcodefourID 	= get_theme_mod( 'bosa_resort_blog_code_four','');

$bosa_resort_codes_array = array();
$bosa_resort_has_codes = false;
if( !empty( $bosa_resort_blogcodeoneID ) ){
	$bosa_resort_blog_code_one  = wp_get_attachment_image_src( $bosa_resort_blogcodeoneID,'bosa-resort-420-300');
 	if ( is_array(  $bosa_resort_blog_code_one ) ){
 		$bosa_resort_has_codes = true;
   	 	$bosa_resort_blog_codes_one = $bosa_resort_blog_code_one[0];
   	 	$bosa_resort_codes_array['image_one'] = array(
			'ID' => $bosa_resort_blog_codes_one,
		);	
  	}
}
if( !empty( $bosa_resort_blogcodetwoID ) ){
	$bosa_resort_blog_code_two = wp_get_attachment_image_src( $bosa_resort_blogcodetwoID,'bosa-resort-420-300');
	if ( is_array(  $bosa_resort_blog_code_two ) ){
		$bosa_resort_has_codes = true;	
        $bosa_resort_blog_codes_two = $bosa_resort_blog_code_two[0];
        $bosa_resort_codes_array['image_two'] = array(
			'ID' => $bosa_resort_blog_codes_two,
		);	
  	}
}
if( !empty( $bosa_resort_blogcodethreeID ) ){	
	$bosa_resort_blog_code_three = wp_get_attachment_image_src( $bosa_resort_blogcodethreeID,'bosa-resort-420-300');
	if ( is_array(  $bosa_resort_blog_code_three ) ){
		$bosa_resort_has_codes = true;
      	$bosa_resort_blog_codes_three = $bosa_resort_blog_code_three[0];
      	$bosa_resort_codes_array['image_three'] = array(
			'ID' => $bosa_resort_blog_codes_three,
		);	
  	}
}
if( !empty( $bosa_resort_blogcodefourID ) ){	
	$bosa_resort_blog_code_four = wp_get_attachment_image_src( $bosa_resort_blogcodefourID,'bosa-resort-420-300');
	if ( is_array(  $bosa_resort_blog_code_four ) ){
		$bosa_resort_has_codes = true;
      	$bosa_resort_blog_codes_four = $bosa_resort_blog_code_four[0];
      	$bosa_resort_codes_array['image_four'] = array(
			'ID' => $bosa_resort_blog_codes_four,
		);	
  	}
}

if( !get_theme_mod( 'bosa_resort_disable_redemption_codes_section', true ) && $bosa_resort_has_codes ){ ?>
	<section class="section-redemption-code-area">
		<div class="content-wrap">
			<div class="row">
				<?php foreach( $bosa_resort_codes_array as $bosa_resort_each_codes ){ ?>
					<div class="col-md-3 col-sm-6">
						<article class="code-content-wrap">
							<figure class= "featured-image">
								<img src="<?php echo esc_url( $bosa_resort_each_codes['ID'] ); ?>">
							</figure>
						</article>
					</div>
				<?php } ?>
			</div>	
		</div>
	</section>
<?php } 