<?php
$bosa_ev_rental_car_vehicle_categoryone = get_theme_mod('bosa_ev_rental_car_vehicle_category_one','');
$bosa_ev_rental_car_vehicle_categoryoneID = get_theme_mod('bosa_ev_rental_car_vehicle_categories_image_one','');

$bosa_ev_rental_car_vehicle_categorytwo = get_theme_mod('bosa_ev_rental_car_vehicle_category_two','');
$bosa_ev_rental_car_vehicle_categorytwoID = get_theme_mod('bosa_ev_rental_car_vehicle_categories_image_two','');

$bosa_ev_rental_car_vehicle_categorythree = get_theme_mod('bosa_ev_rental_car_vehicle_category_three','');
$bosa_ev_rental_car_vehicle_categorythreeID = get_theme_mod('bosa_ev_rental_car_vehicle_categories_image_three','');

$bosa_ev_rental_car_vehicle_categoryfour = get_theme_mod('bosa_ev_rental_car_vehicle_category_four','');
$bosa_ev_rental_car_vehicle_categoryfourID = get_theme_mod('bosa_ev_rental_car_vehicle_categories_image_four','');

$bosa_ev_rental_car_vehicle_categoryfive = get_theme_mod('bosa_ev_rental_car_vehicle_category_five','');
$bosa_ev_rental_car_vehicle_categoryfiveID = get_theme_mod('bosa_ev_rental_car_vehicle_categories_image_five','');


$bosa_ev_rental_car_vehicle_category_array = array();
$bosa_ev_rental_car_has_vehicle_category = false;
if( !empty( $bosa_ev_rental_car_vehicle_categoryoneID ) || !empty($bosa_ev_rental_car_vehicle_categoryone) ){
	$bosa_ev_rental_car_vehicle_category_one  = wp_get_attachment_image_src( $bosa_ev_rental_car_vehicle_categoryoneID,'bosa-ev-rental-car-590-310' );
 	if ( is_array(  $bosa_ev_rental_car_vehicle_category_one ) ){
 		$bosa_ev_rental_car_has_vehicle_category = true;
   	 	$bosa_ev_rental_car_vehicle_categories_one = $bosa_ev_rental_car_vehicle_category_one[0];
   	 	$bosa_ev_rental_car_vehicle_category_array['image_one']['ID'] = $bosa_ev_rental_car_vehicle_categories_one;
  	}
  	if ( !empty($bosa_ev_rental_car_vehicle_categoryone) ){
 		$bosa_ev_rental_car_has_vehicle_category = true;
   	 	$bosa_ev_rental_car_vehicle_category_array['image_one']['category'] =  $bosa_ev_rental_car_vehicle_categoryone;	
  	}
}
if( !empty( $bosa_ev_rental_car_vehicle_categorytwoID ) || !empty($bosa_ev_rental_car_vehicle_categorytwo) ){
	$bosa_ev_rental_car_vehicle_category_two = wp_get_attachment_image_src( $bosa_ev_rental_car_vehicle_categorytwoID,'bosa-ev-rental-car-590-310' );
	if ( is_array(  $bosa_ev_rental_car_vehicle_category_two ) ){
		$bosa_ev_rental_car_has_vehicle_category = true;	
        $bosa_ev_rental_car_vehicle_categories_two = $bosa_ev_rental_car_vehicle_category_two[0];
        $bosa_ev_rental_car_vehicle_category_array['image_two']['ID'] = $bosa_ev_rental_car_vehicle_categories_two;	
  	}
  	if ( !empty($bosa_ev_rental_car_vehicle_categorytwo) ){
 		$bosa_ev_rental_car_has_vehicle_category = true;
   	 	$bosa_ev_rental_car_vehicle_category_array['image_two']['category'] =  $bosa_ev_rental_car_vehicle_categorytwo;	
  	}
}
if( !empty( $bosa_ev_rental_car_vehicle_categorythreeID ) || !empty($bosa_ev_rental_car_vehicle_categorythree) ){
	$bosa_ev_rental_car_vehicle_category_three = wp_get_attachment_image_src( $bosa_ev_rental_car_vehicle_categorythreeID,'bosa-ev-rental-car-590-310' );
	if ( is_array(  $bosa_ev_rental_car_vehicle_category_three ) ){
		$bosa_ev_rental_car_has_vehicle_category = true;	
        $bosa_ev_rental_car_vehicle_categories_three = $bosa_ev_rental_car_vehicle_category_three[0];
        $bosa_ev_rental_car_vehicle_category_array['image_three']['ID'] = $bosa_ev_rental_car_vehicle_categories_three;		
  	}
  	if ( !empty($bosa_ev_rental_car_vehicle_categorythree) ){
 		$bosa_ev_rental_car_has_vehicle_category = true;
   	 	$bosa_ev_rental_car_vehicle_category_array['image_three']['category'] =  $bosa_ev_rental_car_vehicle_categorythree;	
  	}
}

if( !empty( $bosa_ev_rental_car_vehicle_categoryfourID ) || !empty($bosa_ev_rental_car_vehicle_categoryfour) ){	
	$bosa_ev_rental_car_vehicle_category_four = wp_get_attachment_image_src( $bosa_ev_rental_car_vehicle_categoryfourID,'bosa-ev-rental-car-590-310' );
	if ( is_array(  $bosa_ev_rental_car_vehicle_category_four ) ){
		$bosa_ev_rental_car_has_vehicle_category = true;
      	$bosa_ev_rental_car_vehicle_categories_four = $bosa_ev_rental_car_vehicle_category_four[0];
      	$bosa_ev_rental_car_vehicle_category_array['image_four']['ID'] = $bosa_ev_rental_car_vehicle_categories_four;		
  	}
  	if ( !empty($bosa_ev_rental_car_vehicle_categoryfour) ){
 		$bosa_ev_rental_car_has_vehicle_category = true;
   	 	$bosa_ev_rental_car_vehicle_category_array['image_four']['category'] =  $bosa_ev_rental_car_vehicle_categoryfour;	
  	}
}

if( !empty( $bosa_ev_rental_car_vehicle_categoryfiveID ) || !empty($bosa_ev_rental_car_vehicle_categoryfive) ){	
	$bosa_ev_rental_car_vehicle_category_five = wp_get_attachment_image_src( $bosa_ev_rental_car_vehicle_categoryfiveID,'bosa-ev-rental-car-590-310' );
	if ( is_array(  $bosa_ev_rental_car_vehicle_category_five ) ){
		$bosa_ev_rental_car_has_vehicle_category = true;
      	$bosa_ev_rental_car_vehicle_categories_five = $bosa_ev_rental_car_vehicle_category_five[0];
      	$bosa_ev_rental_car_vehicle_category_array['image_five']['ID'] = $bosa_ev_rental_car_vehicle_categories_five;	
  	}
  	if ( !empty($bosa_ev_rental_car_vehicle_categoryfive) ){
 		$bosa_ev_rental_car_has_vehicle_category = true;
   	 	$bosa_ev_rental_car_vehicle_category_array['image_five']['category'] =  $bosa_ev_rental_car_vehicle_categoryfive;	
  	}
}

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