<?php
$bosa_ev_rental_car_blog_rider_one_ID = get_theme_mod( 'bosa_ev_rental_car_blog_rider_one','' );
$bosa_ev_rental_car_blog_rider_two_ID = get_theme_mod( 'bosa_ev_rental_car_blog_rider_two','' );       
$bosa_ev_rental_car_blog_rider_three_ID = get_theme_mod( 'bosa_ev_rental_car_blog_rider_three','' );
$bosa_ev_rental_car_blog_rider_four_ID = get_theme_mod( 'bosa_ev_rental_car_blog_rider_four','' );
$bosa_ev_rental_car_blog_rider_five_ID = get_theme_mod( 'bosa_ev_rental_car_blog_rider_five','' );
$bosa_ev_rental_car_blog_rider_six_ID = get_theme_mod( 'bosa_ev_rental_car_blog_rider_six','' );

$bosa_ev_rental_car_rider_array = array();
$bosa_ev_rental_car_has_rider = false;
$bosa_ev_rental_car_has_rider_text = false;

if ( !empty( get_theme_mod( 'bosa_ev_rental_car_rider_title', '' ) ) ) {
	$bosa_ev_rental_car_has_rider_text = true;
}

if( !empty( $bosa_ev_rental_car_blog_rider_one_ID ) ){
	$bosa_ev_rental_car_blog_rider_one  = wp_get_attachment_image_src( $bosa_ev_rental_car_blog_rider_one_ID,'bosa-ev-rental-car-420-300');
 	if ( is_array(  $bosa_ev_rental_car_blog_rider_one ) ){
 		$bosa_ev_rental_car_has_rider = true;
   	 	$bosa_ev_rental_car_blog_rider_one = $bosa_ev_rental_car_blog_rider_one[0];
   	 	$bosa_ev_rental_car_rider_array['image_one'] = array(
			'ID' => $bosa_ev_rental_car_blog_rider_one,
		);	
  	}
}
if( !empty( $bosa_ev_rental_car_blog_rider_two_ID ) ){
	$bosa_ev_rental_car_blog_rider_two = wp_get_attachment_image_src( $bosa_ev_rental_car_blog_rider_two_ID,'bosa-ev-rental-car-420-300');
	if ( is_array(  $bosa_ev_rental_car_blog_rider_two ) ){
		$bosa_ev_rental_car_has_rider = true;	
        $bosa_ev_rental_car_blog_rider_two = $bosa_ev_rental_car_blog_rider_two[0];
        $bosa_ev_rental_car_rider_array['image_two'] = array(
			'ID' => $bosa_ev_rental_car_blog_rider_two,
		);	
  	}
}
if( !empty( $bosa_ev_rental_car_blog_rider_three_ID ) ){	
	$bosa_ev_rental_car_blog_rider_three = wp_get_attachment_image_src( $bosa_ev_rental_car_blog_rider_three_ID,'bosa-ev-rental-car-420-300');
	if ( is_array(  $bosa_ev_rental_car_blog_rider_three ) ){
		$bosa_ev_rental_car_has_rider = true;
      	$bosa_ev_rental_car_blog_rider_three = $bosa_ev_rental_car_blog_rider_three[0];
      	$bosa_ev_rental_car_rider_array['image_three'] = array(
			'ID' => $bosa_ev_rental_car_blog_rider_three,
		);	
  	}
}
if( !empty( $bosa_ev_rental_car_blog_rider_four_ID ) ){	
	$bosa_ev_rental_car_blog_rider_four = wp_get_attachment_image_src( $bosa_ev_rental_car_blog_rider_four_ID,'bosa-ev-rental-car-420-300');
	if ( is_array(  $bosa_ev_rental_car_blog_rider_four ) ){
		$bosa_ev_rental_car_has_rider = true;
      	$bosa_ev_rental_car_blog_rider_four = $bosa_ev_rental_car_blog_rider_four[0];
      	$bosa_ev_rental_car_rider_array['image_four'] = array(
			'ID' => $bosa_ev_rental_car_blog_rider_four,
		);	
  	}
}
if( !empty( $bosa_ev_rental_car_blog_rider_five_ID ) ){	
	$bosa_ev_rental_car_blog_rider_five = wp_get_attachment_image_src( $bosa_ev_rental_car_blog_rider_five_ID,'bosa-ev-rental-car-420-300');
	if ( is_array(  $bosa_ev_rental_car_blog_rider_five ) ){
		$bosa_ev_rental_car_has_rider = true;
      	$bosa_ev_rental_car_blog_rider_five = $bosa_ev_rental_car_blog_rider_five[0];
      	$bosa_ev_rental_car_rider_array['image_five'] = array(
			'ID' => $bosa_ev_rental_car_blog_rider_five,
		);	
  	}
}
if( !empty( $bosa_ev_rental_car_blog_rider_six_ID ) ){	
	$bosa_ev_rental_car_blog_rider_six = wp_get_attachment_image_src( $bosa_ev_rental_car_blog_rider_six_ID,'bosa-ev-rental-car-420-300');
	if ( is_array(  $bosa_ev_rental_car_blog_rider_six ) ){
		$bosa_ev_rental_car_has_rider = true;
      	$bosa_ev_rental_car_blog_rider_six = $bosa_ev_rental_car_blog_rider_six[0];
      	$bosa_ev_rental_car_rider_array['image_six'] = array(
			'ID' => $bosa_ev_rental_car_blog_rider_six,
		);	
  	}
}

if( !get_theme_mod( 'bosa_ev_rental_car_disable_riders_section', true ) && ($bosa_ev_rental_car_has_rider || $bosa_ev_rental_car_has_rider_text) ) { ?>
	<section class="section-rider-area">
		<?php if($bosa_ev_rental_car_has_rider_text){ ?>
			<div class="rider-section-title-wrap col-lg-6 offset-lg-3 text-center">
				<h2 class="rider-title">
					<?php echo esc_html( get_theme_mod( 'bosa_ev_rental_car_rider_title', '' ) ); ?>
				</h2>
			</div>
		<?php } ?>
		<div class="rider-content-wrap">
			<div class="row justify-content-center rider-row">
				<?php foreach( $bosa_ev_rental_car_rider_array as $bosa_ev_rental_car_each_rider ){ ?>
					<div class="col-sm-4 col-md-3 col-lg-2 rider-column">
						<figure class= "featured-image">
							<img src="<?php echo esc_url( $bosa_ev_rental_car_each_rider['ID'] ); ?>">
						</figure>
					</div>
				<?php } ?>
			</div>	
		</div>	
	</section>
<?php }