<?php
$bosa_political_party_leader_image_one_ID 		= get_theme_mod( 'bosa_political_party_leader_image_one','');
$bosa_political_party_leader_image_two_ID 		= get_theme_mod( 'bosa_political_party_leader_image_two','');       
$bosa_political_party_leader_image_three_ID 	= get_theme_mod( 'bosa_political_party_leader_image_three','');
$bosa_political_party_leader_one_ID 			= get_theme_mod( 'bosa_political_party_leader_one','');
$bosa_political_party_leader_two_ID 			= get_theme_mod( 'bosa_political_party_leader_two','');
$bosa_political_party_leader_three_ID 			= get_theme_mod( 'bosa_political_party_leader_three','');
 
$bosa_political_party_leaders_array = array();
$bosa_political_party_has_leader_img = false;
$bosa_political_party_has_leader_txt = false;
if( !empty( $bosa_political_party_leader_image_one_ID ) ){
	$bosa_political_party_leader_one  = wp_get_attachment_image_src( $bosa_political_party_leader_image_one_ID,'bosa-political-party-420-300');
 	if ( is_array(  $bosa_political_party_leader_one ) ){
 		$bosa_political_party_has_leader_img = true;
 		$bosa_political_party_has_leader_txt = true;
   	 	$bosa_political_party_leaders_one = $bosa_political_party_leader_one[0];
   	 	$bosa_political_party_leaders_array['image_one'] = array(
			'ID' => $bosa_political_party_leaders_one,
			'txt' => $bosa_political_party_leader_one_ID,
		);	
  	}
}
if( !empty( $bosa_political_party_leader_image_two_ID ) ){
	$bosa_political_party_leader_two = wp_get_attachment_image_src( $bosa_political_party_leader_image_two_ID,'bosa-political-party-420-300');
	if ( is_array(  $bosa_political_party_leader_two ) ){
		$bosa_political_party_has_leader_img = true;
		$bosa_political_party_has_leader_txt = true;	
        $bosa_political_party_leaders_two = $bosa_political_party_leader_two[0];
        $bosa_political_party_leaders_array['image_two'] = array(
			'ID' => $bosa_political_party_leaders_two,
			'txt' => $bosa_political_party_leader_two_ID,
		);	
  	}
}
if( !empty( $bosa_political_party_leader_image_three_ID ) ){	
	$bosa_political_party_leader_three = wp_get_attachment_image_src( $bosa_political_party_leader_image_three_ID,'bosa-political-party-420-300');
	if ( is_array(  $bosa_political_party_leader_three ) ){
		$bosa_political_party_has_leader_img = true;
		$bosa_political_party_has_leader_txt = true;
      	$bosa_political_party_leaders_three = $bosa_political_party_leader_three[0];
      	$bosa_political_party_leaders_array['image_three'] = array(
			'ID' => $bosa_political_party_leaders_three,
			'txt' => $bosa_political_party_leader_three_ID,
		);	
  	}
}

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