<?php
/**
 * Template part for displaying content in the main header.
 *
 * This part is responsible for rendering the key elements of the theme's header.
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
 *
 * @package Yaatra
 */

// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

/**
 * hook - yaatra_before_main_header
 * 
 * @since 1.1.0
 */
do_action( 'yaatra_before_main_header' );
?>
<header id="masthead" class="site-header">

    <div class="site-branding">
        <?php
            the_custom_logo();
            if ( is_front_page() || is_home() ) :
        ?>
                <h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
        <?php
            else :
        ?>
                <p class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></p>
        <?php
            endif;
            $yaatra_description = get_bloginfo( 'description', 'display' );
            if ( $yaatra_description || is_customize_preview() ) :
        ?>
                <p class="site-description"><?php echo $yaatra_description; /* WPCS: xss ok. */ ?></p>
        <?php endif; ?>
    </div><!-- .site-branding -->

    <div id="stickyNav" class="cv-menu-wrapper">
        <button class="menu-toggle" aria-controls="primary-menu" aria-expanded="false"><i class="fas fa-bars"></i></button>
        <nav id="site-navigation" class="main-navigation">
            <?php 
                wp_nav_menu( array( 
                    'theme_location' => 'yaatra_primary_menu', 
                    'menu_id' => 'primary-menu',
                ) );
            ?>
        </nav><!-- #site-navigation -->
    </div><!-- .cv-menu-wrapper -->
    <?php
        if ( is_active_sidebar( 'header-sidebar' ) ) {
            dynamic_sidebar( 'header-sidebar' );
        }
    ?>
</header><!-- #masthead -->