<?php
$bosa_yoga_blog_partner_title 	= get_theme_mod( 'bosa_yoga_blog_partner_title','' );
$bosa_yoga_blog_partner_desc_one 	= get_theme_mod( 'bosa_yoga_blog_partner_desc_one','' );
$bosa_yoga_blog_partner_desc_two 	= get_theme_mod( 'bosa_yoga_blog_partner_desc_two','' );
$bosa_yoga_blog_partner_one_ID 	= get_theme_mod( 'bosa_yoga_blog_partner_image_one','' );
$bosa_yoga_blog_partner_two_ID 	= get_theme_mod( 'bosa_yoga_blog_partner_image_two','' );       
$bosa_yoga_blog_partner_three_ID  = get_theme_mod( 'bosa_yoga_blog_partner_image_three','' );
$bosa_yoga_blog_partner_four_ID 	= get_theme_mod( 'bosa_yoga_blog_partner_image_four','' );
$bosa_yoga_blog_partner_five_ID 	= get_theme_mod( 'bosa_yoga_blog_partner_image_five','' );
$bosa_yoga_blog_partner_six_ID 	= get_theme_mod( 'bosa_yoga_blog_partner_image_six','' );

$bosa_yoga_partner_array = array();
$bosa_yoga_has_partner = false;
$bosa_yoga_has_partner_content = false;

if( !empty( $bosa_yoga_blog_partner_title ) || !empty( $bosa_yoga_blog_partner_desc_one ) || !empty( $bosa_yoga_blog_partner_desc_two )){
	$bosa_yoga_has_partner_content = true;
}
if( !empty( $bosa_yoga_blog_partner_one_ID ) ){
	$bosa_yoga_blog_partner_one  = wp_get_attachment_image_src( $bosa_yoga_blog_partner_one_ID,'bosa-yoga-420-380');
 	if ( is_array(  $bosa_yoga_blog_partner_one ) ){
 		$bosa_yoga_has_partner = true;
   	 	$bosa_yoga_blog_partner_one = $bosa_yoga_blog_partner_one[0];
   	 	$bosa_yoga_partner_array['image_one'] = array(
			'ID' => $bosa_yoga_blog_partner_one,
		);	
  	}
}
if( !empty( $bosa_yoga_blog_partner_two_ID ) ){
	$bosa_yoga_blog_partner_two = wp_get_attachment_image_src( $bosa_yoga_blog_partner_two_ID,'bosa-yoga-420-380');
	if ( is_array(  $bosa_yoga_blog_partner_two ) ){
		$bosa_yoga_has_partner = true;	
        $bosa_yoga_blog_partner_two = $bosa_yoga_blog_partner_two[0];
        $bosa_yoga_partner_array['image_two'] = array(
			'ID' => $bosa_yoga_blog_partner_two,
		);	
  	}
}
if( !empty( $bosa_yoga_blog_partner_three_ID ) ){	
	$bosa_yoga_blog_partner_three = wp_get_attachment_image_src( $bosa_yoga_blog_partner_three_ID,'bosa-yoga-420-380');
	if ( is_array(  $bosa_yoga_blog_partner_three ) ){
		$bosa_yoga_has_partner = true;
      	$bosa_yoga_blog_partner_three = $bosa_yoga_blog_partner_three[0];
      	$bosa_yoga_partner_array['image_three'] = array(
			'ID' => $bosa_yoga_blog_partner_three,
		);	
  	}
}
if( !empty( $bosa_yoga_blog_partner_four_ID ) ){	
	$bosa_yoga_blog_partner_four = wp_get_attachment_image_src( $bosa_yoga_blog_partner_four_ID,'bosa-yoga-420-380');
	if ( is_array(  $bosa_yoga_blog_partner_four ) ){
		$bosa_yoga_has_partner = true;
      	$bosa_yoga_blog_partner_four = $bosa_yoga_blog_partner_four[0];
      	$bosa_yoga_partner_array['image_four'] = array(
			'ID' => $bosa_yoga_blog_partner_four,
		);	
  	}
}
if( !empty( $bosa_yoga_blog_partner_five_ID ) ){	
	$bosa_yoga_blog_partner_five = wp_get_attachment_image_src( $bosa_yoga_blog_partner_five_ID,'bosa-yoga-420-380');
	if ( is_array(  $bosa_yoga_blog_partner_five ) ){
		$bosa_yoga_has_partner = true;
      	$bosa_yoga_blog_partner_five = $bosa_yoga_blog_partner_five[0];
      	$bosa_yoga_partner_array['image_five'] = array(
			'ID' => $bosa_yoga_blog_partner_five,
		);	
  	}
}
if( !empty( $bosa_yoga_blog_partner_six_ID ) ){	
	$bosa_yoga_blog_partner_six = wp_get_attachment_image_src( $bosa_yoga_blog_partner_six_ID,'bosa-yoga-420-380');
	if ( is_array(  $bosa_yoga_blog_partner_six ) ){
		$bosa_yoga_has_partner = true;
      	$bosa_yoga_blog_partner_six = $bosa_yoga_blog_partner_six[0];
      	$bosa_yoga_partner_array['image_six'] = array(
			'ID' => $bosa_yoga_blog_partner_six,
		);	
  	}
}

if( !get_theme_mod( 'bosa_yoga_disable_partners_section', true ) && ( $bosa_yoga_has_partner || $bosa_yoga_has_partner_content) ){ ?>
	<section class="section-partner-area">
		<?php if ( $bosa_yoga_has_partner_content ){?>
			<div class="section-content-wrap">
				<h2 class="partner-section-title">
					<?php echo esc_html( get_theme_mod( 'bosa_yoga_blog_partner_title', '' ) ); ?>
				</h2>
				<p class="partner-section-desc">
					<?php echo esc_html( get_theme_mod( 'bosa_yoga_blog_partner_desc_one', '' ) ); ?>
				</p>
				<p class="partner-section-desc">
					<?php echo esc_html( get_theme_mod( 'bosa_yoga_blog_partner_desc_one', '' ) ); ?>
				</p>
			</div>
		<?php } ?>
		<article class="partner-image-wrap">
			<?php foreach( $bosa_yoga_partner_array as $bosa_yoga_each_partner ){ ?>
				<figure class= "featured-image">
					<img src="<?php echo esc_url( $bosa_yoga_each_partner['ID'] ); ?>">
				</figure>
			<?php } ?>
		</article>
	</section>
<?php } 