<?php
$bosa_finance_consult_blog_associate_one_ID = get_theme_mod( 'bosa_finance_consult_blog_associate_one','' );
$bosa_finance_consult_blog_associate_two_ID = get_theme_mod( 'bosa_finance_consult_blog_associate_two','' );       
$bosa_finance_consult_blog_associate_three_ID = get_theme_mod( 'bosa_finance_consult_blog_associate_three','' );
$bosa_finance_consult_blog_associate_four_ID = get_theme_mod( 'bosa_finance_consult_blog_associate_four','' );
$bosa_finance_consult_blog_associate_five_ID = get_theme_mod( 'bosa_finance_consult_blog_associate_five','' );
$bosa_finance_consult_blog_associate_six_ID = get_theme_mod( 'bosa_finance_consult_blog_associate_six','' );

$bosa_finance_consult_associate_array = array();
$bosa_finance_consult_has_associate = false;
$bosa_finance_consult_has_associate_text = false;

if ( !empty( get_theme_mod( 'bosa_finance_consult_associate_title', '' ) ) ) {
	$bosa_finance_consult_has_associate_text = true;
}

if( !empty( $bosa_finance_consult_blog_associate_one_ID ) ){
	$bosa_finance_consult_blog_associate_one  = wp_get_attachment_image_src( $bosa_finance_consult_blog_associate_one_ID,'bosa-finance-consult-420-300');
 	if ( is_array(  $bosa_finance_consult_blog_associate_one ) ){
 		$bosa_finance_consult_has_associate = true;
   	 	$bosa_finance_consult_blog_associate_one = $bosa_finance_consult_blog_associate_one[0];
   	 	$bosa_finance_consult_associate_array['image_one'] = array(
			'ID' => $bosa_finance_consult_blog_associate_one,
		);	
  	}
}
if( !empty( $bosa_finance_consult_blog_associate_two_ID ) ){
	$bosa_finance_consult_blog_associate_two = wp_get_attachment_image_src( $bosa_finance_consult_blog_associate_two_ID,'bosa-finance-consult-420-300');
	if ( is_array(  $bosa_finance_consult_blog_associate_two ) ){
		$bosa_finance_consult_has_associate = true;	
        $bosa_finance_consult_blog_associate_two = $bosa_finance_consult_blog_associate_two[0];
        $bosa_finance_consult_associate_array['image_two'] = array(
			'ID' => $bosa_finance_consult_blog_associate_two,
		);	
  	}
}
if( !empty( $bosa_finance_consult_blog_associate_three_ID ) ){	
	$bosa_finance_consult_blog_associate_three = wp_get_attachment_image_src( $bosa_finance_consult_blog_associate_three_ID,'bosa-finance-consult-420-300');
	if ( is_array(  $bosa_finance_consult_blog_associate_three ) ){
		$bosa_finance_consult_has_associate = true;
      	$bosa_finance_consult_blog_associate_three = $bosa_finance_consult_blog_associate_three[0];
      	$bosa_finance_consult_associate_array['image_three'] = array(
			'ID' => $bosa_finance_consult_blog_associate_three,
		);	
  	}
}
if( !empty( $bosa_finance_consult_blog_associate_four_ID ) ){	
	$bosa_finance_consult_blog_associate_four = wp_get_attachment_image_src( $bosa_finance_consult_blog_associate_four_ID,'bosa-finance-consult-420-300');
	if ( is_array(  $bosa_finance_consult_blog_associate_four ) ){
		$bosa_finance_consult_has_associate = true;
      	$bosa_finance_consult_blog_associate_four = $bosa_finance_consult_blog_associate_four[0];
      	$bosa_finance_consult_associate_array['image_four'] = array(
			'ID' => $bosa_finance_consult_blog_associate_four,
		);	
  	}
}
if( !empty( $bosa_finance_consult_blog_associate_five_ID ) ){	
	$bosa_finance_consult_blog_associate_five = wp_get_attachment_image_src( $bosa_finance_consult_blog_associate_five_ID,'bosa-finance-consult-420-300');
	if ( is_array(  $bosa_finance_consult_blog_associate_five ) ){
		$bosa_finance_consult_has_associate = true;
      	$bosa_finance_consult_blog_associate_five = $bosa_finance_consult_blog_associate_five[0];
      	$bosa_finance_consult_associate_array['image_five'] = array(
			'ID' => $bosa_finance_consult_blog_associate_five,
		);	
  	}
}
if( !empty( $bosa_finance_consult_blog_associate_six_ID ) ){	
	$bosa_finance_consult_blog_associate_six = wp_get_attachment_image_src( $bosa_finance_consult_blog_associate_six_ID,'bosa-finance-consult-420-300');
	if ( is_array(  $bosa_finance_consult_blog_associate_six ) ){
		$bosa_finance_consult_has_associate = true;
      	$bosa_finance_consult_blog_associate_six = $bosa_finance_consult_blog_associate_six[0];
      	$bosa_finance_consult_associate_array['image_six'] = array(
			'ID' => $bosa_finance_consult_blog_associate_six,
		);	
  	}
}

if( !get_theme_mod( 'bosa_finance_consult_disable_associates_section', true ) && ($bosa_finance_consult_has_associate || $bosa_finance_consult_has_associate_text) ) { ?>
	<section class="section-associate-area">
		<?php if($bosa_finance_consult_has_associate_text){ ?>
			<div class="associate-section-title-wrap col-lg-6 offset-lg-3 text-center">
				<h2 class="associate-title">
					<?php echo esc_html( get_theme_mod( 'bosa_finance_consult_associate_title', '' ) ); ?>
				</h2>
			</div>
		<?php } ?>
		<div class="associate-content-wrap">
			<div class="row justify-content-center associate-row">
				<?php foreach( $bosa_finance_consult_associate_array as $bosa_finance_consult_each_associate ){ ?>
					<div class="col-sm-4 col-md-3 col-lg-2 associate-column">
						<figure class= "featured-image">
							<img src="<?php echo esc_url( $bosa_finance_consult_each_associate['ID'] ); ?>">
						</figure>
					</div>
				<?php } ?>
			</div>	
		</div>	
	</section>
<?php }