<?php
$bosa_garden_care_blog_associate_one_ID = get_theme_mod( 'bosa_garden_care_blog_associate_one','' );
$bosa_garden_care_blog_associate_two_ID = get_theme_mod( 'bosa_garden_care_blog_associate_two','' );       
$bosa_garden_care_blog_associate_three_ID = get_theme_mod( 'bosa_garden_care_blog_associate_three','' );
$bosa_garden_care_blog_associate_four_ID = get_theme_mod( 'bosa_garden_care_blog_associate_four','' );
$bosa_garden_care_blog_associate_five_ID = get_theme_mod( 'bosa_garden_care_blog_associate_five','' );
$bosa_garden_care_blog_associate_six_ID = get_theme_mod( 'bosa_garden_care_blog_associate_six','' );

$bosa_garden_care_associate_array = array();
$bosa_garden_care_has_associate = false;
$bosa_garden_care_has_associate_text = false;

if ( !empty( get_theme_mod( 'bosa_garden_care_associate_title', '' ) ) || !empty( get_theme_mod( 'bosa_garden_care_associate_info_one', '' ) )|| !empty( get_theme_mod( 'bosa_garden_care_associate_info_two', '' ) ) ) {
$bosa_garden_care_has_associate_text = true;

}

if( !empty( $bosa_garden_care_blog_associate_one_ID ) ){
	$bosa_garden_care_blog_associate_one  = wp_get_attachment_image_src( $bosa_garden_care_blog_associate_one_ID,'bosa-garden-care-420-300');
 	if ( is_array(  $bosa_garden_care_blog_associate_one ) ){
 		$bosa_garden_care_has_associate = true;
   	 	$bosa_garden_care_blog_associate_one = $bosa_garden_care_blog_associate_one[0];
   	 	$bosa_garden_care_associate_array['image_one'] = array(
			'ID' => $bosa_garden_care_blog_associate_one,
		);	
  	}
}
if( !empty( $bosa_garden_care_blog_associate_two_ID ) ){
	$bosa_garden_care_blog_associate_two = wp_get_attachment_image_src( $bosa_garden_care_blog_associate_two_ID,'bosa-garden-care-420-300');
	if ( is_array(  $bosa_garden_care_blog_associate_two ) ){
		$bosa_garden_care_has_associate = true;	
        $bosa_garden_care_blog_associate_two = $bosa_garden_care_blog_associate_two[0];
        $bosa_garden_care_associate_array['image_two'] = array(
			'ID' => $bosa_garden_care_blog_associate_two,
		);	
  	}
}
if( !empty( $bosa_garden_care_blog_associate_three_ID ) ){	
	$bosa_garden_care_blog_associate_three = wp_get_attachment_image_src( $bosa_garden_care_blog_associate_three_ID,'bosa-garden-care-420-300');
	if ( is_array(  $bosa_garden_care_blog_associate_three ) ){
		$bosa_garden_care_has_associate = true;
      	$bosa_garden_care_blog_associate_three = $bosa_garden_care_blog_associate_three[0];
      	$bosa_garden_care_associate_array['image_three'] = array(
			'ID' => $bosa_garden_care_blog_associate_three,
		);	
  	}
}
if( !empty( $bosa_garden_care_blog_associate_four_ID ) ){	
	$bosa_garden_care_blog_associate_four = wp_get_attachment_image_src( $bosa_garden_care_blog_associate_four_ID,'bosa-garden-care-420-300');
	if ( is_array(  $bosa_garden_care_blog_associate_four ) ){
		$bosa_garden_care_has_associate = true;
      	$bosa_garden_care_blog_associate_four = $bosa_garden_care_blog_associate_four[0];
      	$bosa_garden_care_associate_array['image_four'] = array(
			'ID' => $bosa_garden_care_blog_associate_four,
		);	
  	}
}
if( !empty( $bosa_garden_care_blog_associate_five_ID ) ){	
	$bosa_garden_care_blog_associate_five = wp_get_attachment_image_src( $bosa_garden_care_blog_associate_five_ID,'bosa-garden-care-420-300');
	if ( is_array(  $bosa_garden_care_blog_associate_five ) ){
		$bosa_garden_care_has_associate = true;
      	$bosa_garden_care_blog_associate_five = $bosa_garden_care_blog_associate_five[0];
      	$bosa_garden_care_associate_array['image_five'] = array(
			'ID' => $bosa_garden_care_blog_associate_five,
		);	
  	}
}
if( !empty( $bosa_garden_care_blog_associate_six_ID ) ){	
	$bosa_garden_care_blog_associate_six = wp_get_attachment_image_src( $bosa_garden_care_blog_associate_six_ID,'bosa-garden-care-420-300');
	if ( is_array(  $bosa_garden_care_blog_associate_six ) ){
		$bosa_garden_care_has_associate = true;
      	$bosa_garden_care_blog_associate_six = $bosa_garden_care_blog_associate_six[0];
      	$bosa_garden_care_associate_array['image_six'] = array(
			'ID' => $bosa_garden_care_blog_associate_six,
		);	
  	}
}

if( !get_theme_mod( 'bosa_garden_care_disable_associates_section', true ) && ($bosa_garden_care_has_associate || $bosa_garden_care_has_associate_text) ) { ?>
	<section class="section-associate-area">
		<?php if($bosa_garden_care_has_associate_text){ ?>
			<div class="associate-section-title-wrap">
				<h2 class="associate-title">
					<?php echo esc_html( get_theme_mod( 'bosa_garden_care_associate_title', '' ) ); ?>
				</h2>
				<p class="info-section">
					<?php echo esc_html( get_theme_mod('bosa_garden_care_associate_info_one') ); ?>
				</p>
				<p class="info-section">
					<?php echo esc_html( get_theme_mod('bosa_garden_care_associate_info_two') ); ?>
				</p>
			</div>
		<?php } ?>
		<div class="associate-content-wrap">
			<div class="row justify-content-center associate-row">
				<?php foreach( $bosa_garden_care_associate_array as $bosa_garden_care_each_associate ){ ?>
					<div class="col-sm-6 col-md-4 associate-column">
						<figure class= "featured-image">
							<img src="<?php echo esc_url( $bosa_garden_care_each_associate['ID'] ); ?>">
						</figure>
					</div>
				<?php } ?>
			</div>	
		</div>	
	</section>
<?php }