<?php
$bosa_online_marketing_blogorganizationimageoneID = get_theme_mod( 'bosa_online_marketing_blog_organization_image_one','');
$bosa_online_marketing_blogorganizationimagetwoID = get_theme_mod( 'bosa_online_marketing_blog_organization_image_two','');       
$bosa_online_marketing_blogorganizationimagethreeID = get_theme_mod( 'bosa_online_marketing_blog_organization_image_three','');
$bosa_online_marketing_blogorganizationoneID = get_theme_mod( 'bosa_online_marketing_blog_organization_one','');
$bosa_online_marketing_blogorganizationtwoID = get_theme_mod( 'bosa_online_marketing_blog_organization_two','');
$bosa_online_marketing_blogorganizationthreeID = get_theme_mod( 'bosa_online_marketing_blog_organization_three','');
 
$bosa_online_marketing_organizations_array = array();
$bosa_online_marketing_has_organization_img = false;
$bosa_online_marketing_has_organization_txt = false;
if( !empty( $bosa_online_marketing_blogorganizationimageoneID ) ){
	$bosa_online_marketing_blog_organization_one  = wp_get_attachment_image_src( $bosa_online_marketing_blogorganizationimageoneID,'bosa-online-marketing-420-300');
 	if ( is_array(  $bosa_online_marketing_blog_organization_one ) ){
 		$bosa_online_marketing_has_organization_img = true;
 		$bosa_online_marketing_has_organization_txt = true;
   	 	$bosa_online_marketing_blog_organizations_one = $bosa_online_marketing_blog_organization_one[0];
   	 	$bosa_online_marketing_organizations_array['image_one'] = array(
			'ID' => $bosa_online_marketing_blog_organizations_one,
			'txt' => $bosa_online_marketing_blogorganizationoneID,
		);	
  	}
}
if( !empty( $bosa_online_marketing_blogorganizationimagetwoID ) ){
	$bosa_online_marketing_blog_organization_two = wp_get_attachment_image_src( $bosa_online_marketing_blogorganizationimagetwoID,'bosa-online-marketing-420-300');
	if ( is_array(  $bosa_online_marketing_blog_organization_two ) ){
		$bosa_online_marketing_has_organization_img = true;
		$bosa_online_marketing_has_organization_txt = true;	
        $bosa_online_marketing_blog_organizations_two = $bosa_online_marketing_blog_organization_two[0];
        $bosa_online_marketing_organizations_array['image_two'] = array(
			'ID' => $bosa_online_marketing_blog_organizations_two,
			'txt' => $bosa_online_marketing_blogorganizationtwoID,
		);	
  	}
}
if( !empty( $bosa_online_marketing_blogorganizationimagethreeID ) ){	
	$bosa_online_marketing_blog_organization_three = wp_get_attachment_image_src( $bosa_online_marketing_blogorganizationimagethreeID,'bosa-online-marketing-420-300');
	if ( is_array(  $bosa_online_marketing_blog_organization_three ) ){
		$bosa_online_marketing_has_organization_img = true;
		$bosa_online_marketing_has_organization_txt = true;
      	$bosa_online_marketing_blog_organizations_three = $bosa_online_marketing_blog_organization_three[0];
      	$bosa_online_marketing_organizations_array['image_three'] = array(
			'ID' => $bosa_online_marketing_blog_organizations_three,
			'txt' => $bosa_online_marketing_blogorganizationthreeID,
		);	
  	}
}

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