<?php
$bosa_handyman_services_campaignlistone = get_theme_mod('bosa_handyman_services_campaign_list_one','');
$bosa_handyman_services_campaignlistoneID = get_theme_mod('bosa_handyman_services_campaign_lists_image_one','');

$bosa_handyman_services_campaignlisttwo = get_theme_mod('bosa_handyman_services_campaign_list_two','');
$bosa_handyman_services_campaignlisttwoID = get_theme_mod('bosa_handyman_services_campaign_lists_image_two','');

$bosa_handyman_services_campaignlistthree = get_theme_mod('bosa_handyman_services_campaign_list_three','');
$bosa_handyman_services_campaignlistthreeID = get_theme_mod('bosa_handyman_services_campaign_lists_image_three','');

$bosa_handyman_services_campaignlistfour = get_theme_mod('bosa_handyman_services_campaign_list_four','');
$bosa_handyman_services_campaignlistfourID = get_theme_mod('bosa_handyman_services_campaign_lists_image_four','');

$bosa_handyman_services_campaignlistfive = get_theme_mod('bosa_handyman_services_campaign_list_five','');
$bosa_handyman_services_campaignlistfiveID = get_theme_mod('bosa_handyman_services_campaign_lists_image_five','');


$bosa_handyman_services_campaignlist_array = array();
$bosa_handyman_services_has_campaignlist = false;
if( !empty( $bosa_handyman_services_campaignlistoneID ) || !empty($bosa_handyman_services_campaignlistone) ){
	$bosa_handyman_services_campaign_list_one  = wp_get_attachment_image_src( $bosa_handyman_services_campaignlistoneID,'bosa-handyman-services-590-310' );
 	if ( is_array(  $bosa_handyman_services_campaign_list_one ) ){
 		$bosa_handyman_services_has_campaignlist = true;
   	 	$bosa_handyman_services_campaign_lists_one = $bosa_handyman_services_campaign_list_one[0];
   	 	$bosa_handyman_services_campaignlist_array['image_one']['ID'] = $bosa_handyman_services_campaign_lists_one;
  	}
  	if ( !empty($bosa_handyman_services_campaignlistone) ){
 		$bosa_handyman_services_has_campaignlist = true;
   	 	$bosa_handyman_services_campaignlist_array['image_one']['category'] =  $bosa_handyman_services_campaignlistone;	
  	}
}
if( !empty( $bosa_handyman_services_campaignlisttwoID ) || !empty($bosa_handyman_services_campaignlisttwo) ){
	$bosa_handyman_services_campaign_list_two = wp_get_attachment_image_src( $bosa_handyman_services_campaignlisttwoID,'bosa-handyman-services-590-310' );
	if ( is_array(  $bosa_handyman_services_campaign_list_two ) ){
		$bosa_handyman_services_has_campaignlist = true;	
        $bosa_handyman_services_campaign_lists_two = $bosa_handyman_services_campaign_list_two[0];
        $bosa_handyman_services_campaignlist_array['image_two']['ID'] = $bosa_handyman_services_campaign_lists_two;	
  	}
  	if ( !empty($bosa_handyman_services_campaignlisttwo) ){
 		$bosa_handyman_services_has_campaignlist = true;
   	 	$bosa_handyman_services_campaignlist_array['image_two']['category'] =  $bosa_handyman_services_campaignlisttwo;	
  	}
}
if( !empty( $bosa_handyman_services_campaignlistthreeID ) || !empty($bosa_handyman_services_campaignlistthree) ){
	$bosa_handyman_services_campaign_list_three = wp_get_attachment_image_src( $bosa_handyman_services_campaignlistthreeID,'bosa-handyman-services-590-310' );
	if ( is_array(  $bosa_handyman_services_campaign_list_three ) ){
		$bosa_handyman_services_has_campaignlist = true;	
        $bosa_handyman_services_campaign_lists_three = $bosa_handyman_services_campaign_list_three[0];
        $bosa_handyman_services_campaignlist_array['image_three']['ID'] = $bosa_handyman_services_campaign_lists_three;		
  	}
  	if ( !empty($bosa_handyman_services_campaignlistthree) ){
 		$bosa_handyman_services_has_campaignlist = true;
   	 	$bosa_handyman_services_campaignlist_array['image_three']['category'] =  $bosa_handyman_services_campaignlistthree;	
  	}
}

if( !empty( $bosa_handyman_services_campaignlistfourID ) || !empty($bosa_handyman_services_campaignlistfour) ){	
	$bosa_handyman_services_campaign_list_four = wp_get_attachment_image_src( $bosa_handyman_services_campaignlistfourID,'bosa-handyman-services-590-310' );
	if ( is_array(  $bosa_handyman_services_campaign_list_four ) ){
		$bosa_handyman_services_has_campaignlist = true;
      	$bosa_handyman_services_campaign_lists_four = $bosa_handyman_services_campaign_list_four[0];
      	$bosa_handyman_services_campaignlist_array['image_four']['ID'] = $bosa_handyman_services_campaign_lists_four;		
  	}
  	if ( !empty($bosa_handyman_services_campaignlistfour) ){
 		$bosa_handyman_services_has_campaignlist = true;
   	 	$bosa_handyman_services_campaignlist_array['image_four']['category'] =  $bosa_handyman_services_campaignlistfour;	
  	}
}

if( !empty( $bosa_handyman_services_campaignlistfiveID ) || !empty($bosa_handyman_services_campaignlistfive) ){	
	$bosa_handyman_services_campaign_list_five = wp_get_attachment_image_src( $bosa_handyman_services_campaignlistfiveID,'bosa-handyman-services-590-310' );
	if ( is_array(  $bosa_handyman_services_campaign_list_five ) ){
		$bosa_handyman_services_has_campaignlist = true;
      	$bosa_handyman_services_campaign_lists_five = $bosa_handyman_services_campaign_list_five[0];
      	$bosa_handyman_services_campaignlist_array['image_five']['ID'] = $bosa_handyman_services_campaign_lists_five;	
  	}
  	if ( !empty($bosa_handyman_services_campaignlistfive) ){
 		$bosa_handyman_services_has_campaignlist = true;
   	 	$bosa_handyman_services_campaignlist_array['image_five']['category'] =  $bosa_handyman_services_campaignlistfive;	
  	}
}

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