<?php
$options = _WSH()->option();
$topbar = buildark_set( $options, 'show_topbar_header2' );
$social_media1 = buildark_set( $options, 'social_media2' );
$social_media = buildark_set( $social_media1, 'social_media2' );
$address = buildark_set( $options, 'header2_address' );
$phone = buildark_set( $options, 'header2_phone' );
$offices1 = buildark_set( $options, 'header2_offices' );
$offices = buildark_set( $offices1, 'header2_offices' );
if ( $offices ) {
	$first_office = array_slice( $offices,0,1 );
}

if ( $topbar ) :

?>
<!--Header Top-->
<div class="header-top-two">

	<div class="auto-container">
	
		<div class="clearfix">
		
			<div class="top-left">
			
				<ul class="clearfix">
				
					<li>
						<div class="social-links">
						
							<?php  if ( $social_media ) :  ?>
						
								<?php  foreach ( $social_media as $media ) :

									if ( isset( $media['tocopy' ] ) ) continue;

									$link = buildark_set( $media, 'social_link');

									$icon = buildark_set( $media, 'social_icon');

								?>
							
							<a href="<?php echo esc_url( $link ); ?>">
									
										<span class="fa <?php echo esc_attr( $icon ); ?>"></span>
									</a>

								<?php endforeach; ?>
								
							<?php endif; ?>
							
						</div>
					</li>
					
					<?php  if ( $address ) :   ?>
					
						<li>
							<span class="icon flaticon-map-marker"></span><?php echo wp_kses_post( $address );  ?>
						</li>
						
					<?php
						endif;
					
					if ( $phone ) :
					
					?>

						<li>
							<span class="icon flaticon-telephone-handle-silhouette"></span><?php echo wp_kses_post( $phone );  ?>
						</li>
						
					<?php endif; ?>
					
				</ul>
			</div>
			<div class="top-right clearfix">
				<ul class="clearfix">
					<li class="language dropdown">
					
						<?php if ( $first_office ) :
						
						foreach ( $first_office as $f_office ) :
						
								$f_name = buildark_set( $f_office, 'office_name');

								$f_link = buildark_set( $f_office, 'office_link');
						
						?>
					
							<a class="btn btn-default dropdown-toggle" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true" href="<?php echo esc_url( $f_link ); ?>">&ensp; <?php echo wp_kses_post( $f_name );  ?> 
							<span class="icon fa fa-angle-down"></span>
							</a>
						
						<?php endforeach; endif; ?>
						
						<ul class="dropdown-menu style-one" aria-labelledby="dropdownMenu1">
						
						
							<?php  if ( $offices ) :  ?>
						
								<?php  foreach ( $offices as $office ) :

									if ( isset( $office['tocopy' ] ) ) continue;

									$name = buildark_set( $office, 'office_name');

									$link = buildark_set( $office, 'office_link');

								?>
								
									<li>
										<a href="<?php echo esc_url( $link ); ?>"><?php echo wp_kses_post( $name ); ?></a>
									</li>

								<?php endforeach; ?>
								
							<?php endif; ?>
						
						</ul>
					</li>
				</ul>

			</div>
		</div>
	</div>
</div>


<?php endif; ?>