<?php
$bosa_courier_service_campaignlistone = get_theme_mod('bosa_courier_service_campaign_list_one','');
$bosa_courier_service_campaignlistoneID = get_theme_mod('bosa_courier_service_campaign_lists_image_one','');

$bosa_courier_service_campaignlisttwo = get_theme_mod('bosa_courier_service_campaign_list_two','');
$bosa_courier_service_campaignlisttwoID = get_theme_mod('bosa_courier_service_campaign_lists_image_two','');

$bosa_courier_service_campaignlistthree = get_theme_mod('bosa_courier_service_campaign_list_three','');
$bosa_courier_service_campaignlistthreeID = get_theme_mod('bosa_courier_service_campaign_lists_image_three','');

$bosa_courier_service_campaignlistfour = get_theme_mod('bosa_courier_service_campaign_list_four','');
$bosa_courier_service_campaignlistfourID = get_theme_mod('bosa_courier_service_campaign_lists_image_four','');

$bosa_courier_service_campaignlistfive = get_theme_mod('bosa_courier_service_campaign_list_five','');
$bosa_courier_service_campaignlistfiveID = get_theme_mod('bosa_courier_service_campaign_lists_image_five','');

$bosa_courier_service_campaignlistsix = get_theme_mod('bosa_courier_service_campaign_list_six','');
$bosa_courier_service_campaignlistsixID = get_theme_mod('bosa_courier_service_campaign_lists_image_six','');


$bosa_courier_service_campaignlist_array = array();
$bosa_courier_service_has_campaignlist = false;
if( !empty( $bosa_courier_service_campaignlistoneID ) || !empty($bosa_courier_service_campaignlistone) ){
	$bosa_courier_service_campaign_list_one  = wp_get_attachment_image_src( $bosa_courier_service_campaignlistoneID,'bosa-courier-service-590-310' );
 	if ( is_array(  $bosa_courier_service_campaign_list_one ) ){
 		$bosa_courier_service_has_campaignlist = true;
   	 	$bosa_courier_service_campaign_lists_one = $bosa_courier_service_campaign_list_one[0];
   	 	$bosa_courier_service_campaignlist_array['image_one']['ID'] = $bosa_courier_service_campaign_lists_one;
  	}
  	if ( !empty($bosa_courier_service_campaignlistone) ){
 		$bosa_courier_service_has_campaignlist = true;
   	 	$bosa_courier_service_campaignlist_array['image_one']['category'] =  $bosa_courier_service_campaignlistone;	
  	}
}
if( !empty( $bosa_courier_service_campaignlisttwoID ) || !empty($bosa_courier_service_campaignlisttwo) ){
	$bosa_courier_service_campaign_list_two = wp_get_attachment_image_src( $bosa_courier_service_campaignlisttwoID,'bosa-courier-service-590-310' );
	if ( is_array(  $bosa_courier_service_campaign_list_two ) ){
		$bosa_courier_service_has_campaignlist = true;	
        $bosa_courier_service_campaign_lists_two = $bosa_courier_service_campaign_list_two[0];
        $bosa_courier_service_campaignlist_array['image_two']['ID'] = $bosa_courier_service_campaign_lists_two;	
  	}
  	if ( !empty($bosa_courier_service_campaignlisttwo) ){
 		$bosa_courier_service_has_campaignlist = true;
   	 	$bosa_courier_service_campaignlist_array['image_two']['category'] =  $bosa_courier_service_campaignlisttwo;	
  	}
}
if( !empty( $bosa_courier_service_campaignlistthreeID ) || !empty($bosa_courier_service_campaignlistthree) ){
	$bosa_courier_service_campaign_list_three = wp_get_attachment_image_src( $bosa_courier_service_campaignlistthreeID,'bosa-courier-service-590-310' );
	if ( is_array(  $bosa_courier_service_campaign_list_three ) ){
		$bosa_courier_service_has_campaignlist = true;	
        $bosa_courier_service_campaign_lists_three = $bosa_courier_service_campaign_list_three[0];
        $bosa_courier_service_campaignlist_array['image_three']['ID'] = $bosa_courier_service_campaign_lists_three;		
  	}
  	if ( !empty($bosa_courier_service_campaignlistthree) ){
 		$bosa_courier_service_has_campaignlist = true;
   	 	$bosa_courier_service_campaignlist_array['image_three']['category'] =  $bosa_courier_service_campaignlistthree;	
  	}
}

if( !empty( $bosa_courier_service_campaignlistfourID ) || !empty($bosa_courier_service_campaignlistfour) ){	
	$bosa_courier_service_campaign_list_four = wp_get_attachment_image_src( $bosa_courier_service_campaignlistfourID,'bosa-courier-service-590-310' );
	if ( is_array(  $bosa_courier_service_campaign_list_four ) ){
		$bosa_courier_service_has_campaignlist = true;
      	$bosa_courier_service_campaign_lists_four = $bosa_courier_service_campaign_list_four[0];
      	$bosa_courier_service_campaignlist_array['image_four']['ID'] = $bosa_courier_service_campaign_lists_four;		
  	}
  	if ( !empty($bosa_courier_service_campaignlistfour) ){
 		$bosa_courier_service_has_campaignlist = true;
   	 	$bosa_courier_service_campaignlist_array['image_four']['category'] =  $bosa_courier_service_campaignlistfour;	
  	}
}

if( !empty( $bosa_courier_service_campaignlistfiveID ) || !empty($bosa_courier_service_campaignlistfive) ){	
	$bosa_courier_service_campaign_list_five = wp_get_attachment_image_src( $bosa_courier_service_campaignlistfiveID,'bosa-courier-service-590-310' );
	if ( is_array(  $bosa_courier_service_campaign_list_five ) ){
		$bosa_courier_service_has_campaignlist = true;
      	$bosa_courier_service_campaign_lists_five = $bosa_courier_service_campaign_list_five[0];
      	$bosa_courier_service_campaignlist_array['image_five']['ID'] = $bosa_courier_service_campaign_lists_five;	
  	}
  	if ( !empty($bosa_courier_service_campaignlistfive) ){
 		$bosa_courier_service_has_campaignlist = true;
   	 	$bosa_courier_service_campaignlist_array['image_five']['category'] =  $bosa_courier_service_campaignlistfive;	
  	}
}

if( !empty( $bosa_courier_service_campaignlistsixID ) || !empty($bosa_courier_service_campaignlistsix) ){	
	$bosa_courier_service_campaign_list_six = wp_get_attachment_image_src( $bosa_courier_service_campaignlistsixID,'bosa-courier-service-590-310' );
	if ( is_array(  $bosa_courier_service_campaign_list_six ) ){
		$bosa_courier_service_has_campaignlist = true;
      	$bosa_courier_service_campaign_lists_six = $bosa_courier_service_campaign_list_six[0];
      	$bosa_courier_service_campaignlist_array['image_six']['ID'] = $bosa_courier_service_campaign_lists_six;	
  	}
  	if ( !empty($bosa_courier_service_campaignlistsix) ){
 		$bosa_courier_service_has_campaignlist = true;
   	 	$bosa_courier_service_campaignlist_array['image_six']['category'] =  $bosa_courier_service_campaignlistsix;	
  	}
}

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