<?php
/**
 * The header for our theme including the navigation and the photo header
 *
 * @package ClubTravel
 */

?><!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="profile" href="http://gmpg.org/xfn/11">
<?php if ( is_singular() && pings_open() ) : ?>
<link rel="pingback" href="<?php echo esc_url( get_bloginfo( 'pingback_url' ) ); ?>">
<?php endif; ?>
<?php wp_head(); ?>
</head>

<body <?php body_class(); ?>>

<?php
if ( function_exists( 'wp_body_open' ) ) {
	wp_body_open();
}
?>

<nav class="navbar navbar-expand-lg static-top border-top">
	<div class="container">
		<a class="navbar-brand" href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">
			<?php
			$clubtravel_custom_logo_id = get_theme_mod( 'custom_logo' );
			$clubtravel_logo           = wp_get_attachment_image_src( $clubtravel_custom_logo_id, 'full' );
			$clubtravel_description    = get_bloginfo( 'description', 'display' );
			?>
			<?php if ( has_custom_logo() ) : ?>
				<img src="<?php echo esc_url( $clubtravel_logo[0] ); ?>" class="img-fluid">
			<?php else : ?>
				<span class="site-title"><?php bloginfo( 'name' ); ?></span>
				<?php if ( $clubtravel_description || is_customize_preview() ) : ?>
					<span class="site-description d-table"><?php echo esc_html( $clubtravel_description ); ?></span>
				<?php endif; ?>
			<?php endif; ?>
		</a>
		<button class="navbar-toggler ml-auto border-0 rounded-circle collapsed" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="<?php esc_attr__( 'Toggle navigation', 'clubtravel' ); ?>">
			<span class="navbar-toggler-line position-relative mb-1 rounded"></span>
			<span class="navbar-toggler-line position-relative mb-1 rounded"></span>
			<span class="navbar-toggler-line position-relative rounded"></span>
		</button>
		<div class="collapse navbar-collapse" id="navbarSupportedContent">
			<ul class="navbar-nav ml-auto">
				<?php clubtravel_bootstrap_menu(); ?>
			</ul>
		</div>
	</div>
</nav>

<?php if ( is_front_page() || is_home() ) : ?>
	<?php if ( is_active_sidebar( 'header-sidebar' ) ) : ?>
		<?php if ( get_header_image() ) : ?>
			<div class="site-header site-header-image position-relative" style="background-image:url('<?php header_image(); ?>');">
		<?php else : ?>
			<div class="site-header site-header-image position-relative">
		<?php endif; ?>
	<?php else : ?>
		<?php if ( get_header_image() ) : ?>
			<div class="site-header position-relative" style="background-image:url('<?php header_image(); ?>');">
		<?php else : ?>
			<div class="site-header position-relative">
		<?php endif; ?>
	<?php endif; ?>
<?php else : ?>
	<?php if ( get_header_image() ) : ?>
		<div class="site-header position-relative" style="background-image:url('<?php header_image(); ?>');">
	<?php else : ?>
		<div class="site-header position-relative">
	<?php endif; ?>
<?php endif; ?>
	<div class="container h-100">
		<div class="row h-100">
			<div class="col-12 col-sm-8 offset-sm-2 h-100 d-flex align-items-center text-center">
				<?php if ( is_front_page() || is_home() ) : ?>
					<?php if ( is_active_sidebar( 'header-sidebar' ) ) : ?>
						<?php dynamic_sidebar( 'header-sidebar' ); ?>
					<?php endif; ?>
				<?php endif; ?>
			</div>
		</div>
	</div>
	<?php if ( is_front_page() || is_home() ) : ?>
		<?php get_template_part( 'inc/social' ); ?>
	<?php endif; ?>
</div>
