<?php
$bosa_charity_firm_campaignlistone = get_theme_mod('bosa_charity_firm_campaign_list_one','');
$bosa_charity_firm_campaignlistoneID = get_theme_mod('bosa_charity_firm_campaign_lists_image_one','');

$bosa_charity_firm_campaignlisttwo = get_theme_mod('bosa_charity_firm_campaign_list_two','');
$bosa_charity_firm_campaignlisttwoID = get_theme_mod('bosa_charity_firm_campaign_lists_image_two','');

$bosa_charity_firm_campaignlistthree = get_theme_mod('bosa_charity_firm_campaign_list_three','');
$bosa_charity_firm_campaignlistthreeID = get_theme_mod('bosa_charity_firm_campaign_lists_image_three','');

$bosa_charity_firm_campaignlistfour = get_theme_mod('bosa_charity_firm_campaign_list_four','');
$bosa_charity_firm_campaignlistfourID = get_theme_mod('bosa_charity_firm_campaign_lists_image_four','');

$bosa_charity_firm_campaignlistfive = get_theme_mod('bosa_charity_firm_campaign_list_five','');
$bosa_charity_firm_campaignlistfiveID = get_theme_mod('bosa_charity_firm_campaign_lists_image_five','');


$bosa_charity_firm_campaignlist_array = array();
$bosa_charity_firm_has_campaignlist = false;
if( !empty( $bosa_charity_firm_campaignlistoneID ) || !empty($bosa_charity_firm_campaignlistone) ){
	$bosa_charity_firm_campaign_list_one  = wp_get_attachment_image_src( $bosa_charity_firm_campaignlistoneID,'bosa-charity-firm-590-310' );
 	if ( is_array(  $bosa_charity_firm_campaign_list_one ) ){
 		$bosa_charity_firm_has_campaignlist = true;
   	 	$bosa_charity_firm_campaign_lists_one = $bosa_charity_firm_campaign_list_one[0];
   	 	$bosa_charity_firm_campaignlist_array['image_one']['ID'] = $bosa_charity_firm_campaign_lists_one;
  	}
  	if ( !empty($bosa_charity_firm_campaignlistone) ){
 		$bosa_charity_firm_has_campaignlist = true;
   	 	$bosa_charity_firm_campaignlist_array['image_one']['category'] =  $bosa_charity_firm_campaignlistone;	
  	}
}
if( !empty( $bosa_charity_firm_campaignlisttwoID ) || !empty($bosa_charity_firm_campaignlisttwo) ){
	$bosa_charity_firm_campaign_list_two = wp_get_attachment_image_src( $bosa_charity_firm_campaignlisttwoID,'bosa-charity-firm-590-310' );
	if ( is_array(  $bosa_charity_firm_campaign_list_two ) ){
		$bosa_charity_firm_has_campaignlist = true;	
        $bosa_charity_firm_campaign_lists_two = $bosa_charity_firm_campaign_list_two[0];
        $bosa_charity_firm_campaignlist_array['image_two']['ID'] = $bosa_charity_firm_campaign_lists_two;	
  	}
  	if ( !empty($bosa_charity_firm_campaignlisttwo) ){
 		$bosa_charity_firm_has_campaignlist = true;
   	 	$bosa_charity_firm_campaignlist_array['image_two']['category'] =  $bosa_charity_firm_campaignlisttwo;	
  	}
}
if( !empty( $bosa_charity_firm_campaignlistthreeID ) || !empty($bosa_charity_firm_campaignlistthree) ){
	$bosa_charity_firm_campaign_list_three = wp_get_attachment_image_src( $bosa_charity_firm_campaignlistthreeID,'bosa-charity-firm-590-310' );
	if ( is_array(  $bosa_charity_firm_campaign_list_three ) ){
		$bosa_charity_firm_has_campaignlist = true;	
        $bosa_charity_firm_campaign_lists_three = $bosa_charity_firm_campaign_list_three[0];
        $bosa_charity_firm_campaignlist_array['image_three']['ID'] = $bosa_charity_firm_campaign_lists_three;		
  	}
  	if ( !empty($bosa_charity_firm_campaignlistthree) ){
 		$bosa_charity_firm_has_campaignlist = true;
   	 	$bosa_charity_firm_campaignlist_array['image_three']['category'] =  $bosa_charity_firm_campaignlistthree;	
  	}
}

if( !empty( $bosa_charity_firm_campaignlistfourID ) || !empty($bosa_charity_firm_campaignlistfour) ){	
	$bosa_charity_firm_campaign_list_four = wp_get_attachment_image_src( $bosa_charity_firm_campaignlistfourID,'bosa-charity-firm-590-310' );
	if ( is_array(  $bosa_charity_firm_campaign_list_four ) ){
		$bosa_charity_firm_has_campaignlist = true;
      	$bosa_charity_firm_campaign_lists_four = $bosa_charity_firm_campaign_list_four[0];
      	$bosa_charity_firm_campaignlist_array['image_four']['ID'] = $bosa_charity_firm_campaign_lists_four;		
  	}
  	if ( !empty($bosa_charity_firm_campaignlistfour) ){
 		$bosa_charity_firm_has_campaignlist = true;
   	 	$bosa_charity_firm_campaignlist_array['image_four']['category'] =  $bosa_charity_firm_campaignlistfour;	
  	}
}

if( !empty( $bosa_charity_firm_campaignlistfiveID ) || !empty($bosa_charity_firm_campaignlistfive) ){	
	$bosa_charity_firm_campaign_list_five = wp_get_attachment_image_src( $bosa_charity_firm_campaignlistfiveID,'bosa-charity-firm-590-310' );
	if ( is_array(  $bosa_charity_firm_campaign_list_five ) ){
		$bosa_charity_firm_has_campaignlist = true;
      	$bosa_charity_firm_campaign_lists_five = $bosa_charity_firm_campaign_list_five[0];
      	$bosa_charity_firm_campaignlist_array['image_five']['ID'] = $bosa_charity_firm_campaign_lists_five;	
  	}
  	if ( !empty($bosa_charity_firm_campaignlistfive) ){
 		$bosa_charity_firm_has_campaignlist = true;
   	 	$bosa_charity_firm_campaignlist_array['image_five']['category'] =  $bosa_charity_firm_campaignlistfive;	
  	}
}

if( !get_theme_mod( 'bosa_charity_firm_disable_campaign_lists_section', true ) && $bosa_charity_firm_has_campaignlist ){ ?>
	<section class="section-campaign-list-area">
		<div class="content-wrap">
			<?php foreach( $bosa_charity_firm_campaignlist_array as $bosa_charity_firm_each_campaignlist ){ ?>
				<article class="campaign-content-wrap">
					<?php if ( isset( $bosa_charity_firm_each_campaignlist['ID'] ) && !empty( $bosa_charity_firm_each_campaignlist['ID'] ) ){ ?>
						<figure class= "featured-image">
							<img src="<?php echo esc_url( $bosa_charity_firm_each_campaignlist['ID'] ); ?>">
						</figure>
					<?php } ?>
					<?php if ( isset( $bosa_charity_firm_each_campaignlist['category'] ) && !empty( $bosa_charity_firm_each_campaignlist['category'] ) ){ ?>
						<h5 class="entry-title">
							<a href="<?php echo esc_url( get_category_link( $bosa_charity_firm_each_campaignlist ['category'] ) ); ?>">
									<?php echo esc_html(get_cat_name( $bosa_charity_firm_each_campaignlist ['category'] ) ); ?>
								<i class="fas fa-arrow-right right-arrow"></i>
							</a>	
						</h5>
					<?php } ?>
				</article>
			<?php } ?>
		</div>
	</section>
<?php } 
