<?php
/**
 * The header for our theme
 *
 * This is the template that displays all of the <head> section and everything up until <div id="content">
 *
 * @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
 *
 * @package warego
 */
?>
<!doctype html>
<html <?php language_attributes(); ?>>
<head>
	<meta charset="<?php bloginfo( 'charset' ); ?>">
	<meta name="viewport" content="width=device-width, initial-scale=1">
    <base href="<?php echo site_url() . '/'; ?>">
	<link rel="profile" href="https://gmpg.org/xfn/11">
	<link rel="icon" href="/favicon.ico"/>
	<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
	<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
	<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
	<link rel="manifest" href="/site.webmanifest">
    <?php wp_head(); ?>
	

    <?php
        $page_schema = get_field('page_schema');
        // Page Schema
        echo $page_schema ? $page_schema : '';
    ?>
    

    <style>
        .holiday-modal .gccphone {
            padding: 7px 45px !important;
        }
        @media(min-width:992px){
            .holiday-modal .gccphone::placeholder {
                color:#fff;
            }
        }
    </style>
</head>

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


<?php
// Check if the current URL path is in the array

/* if (!is_page('pricing') && !is_page('contact-us') && !is_page('signup')) { 
    get_template_part('templates-parts/pages/holiday-bar');
    get_template_part('templates-parts/modals/holiday-modal');
} */

?>



<header>
    <div class="topbar"></div>
    <div class="progress-container">
        <div class="progress-bar" id="myBar"></div>
    </div>
    <nav class="navbar navbar-expand-lg">
        <div class="container">
        <a class="navbar-brand" href="<?php echo home_url(); ?>">
    <?php 
    if (has_custom_logo()) {
        the_custom_logo(); // This will display the uploaded logo
    } else { ?>
        <img src="<?php echo get_template_directory_uri(); ?>/assets/img/logo.webp" class="img-fluid" alt="logo" loading="lazy">
    <?php } ?>
</a>

            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarText"
                    aria-controls="navbarText" aria-expanded="false" aria-label="Toggle navigation">
                <span class="navbar-toggler-icon">☰</span>
            </button>
            <div class="collapse navbar-collapse justify-content-end" id="navbarText">
    <?php
        $primary_nav = wp_nav_menu(array(
            'theme_location' => 'primary-menu',
            'container'      => false,
            'echo'           => false,
            'menu_class'     => 'navbar-nav mb-2 mb-lg-0',
            'fallback_cb'    => '__return_false',
            'items_wrap'     => '<ul id="%1$s" class="%2$s">%3$s</ul>',
            'depth'          => 2,
            'walker'         => new WP_Bootstrap_Navwalker(),
        ));

        $get_template_directory = get_template_directory() . '/';
        
        // If navigation file not exist
        if (!file_exists($get_template_directory . 'primary-nav.txt')) {
            file_put_contents( $get_template_directory . 'primary-nav.txt', $primary_nav );
        // If navigation file exist but not has enough content
        } elseif ( strlen(file_get_contents($get_template_directory . 'primary-nav.txt')) < 100 ) {
            file_put_contents( $get_template_directory . 'primary-nav.txt', $primary_nav );
        }

        echo $primary_nav;
    ?>
    <div class="contact-btn">
        <a href="<?php echo site_url();?>/signup/">Start for free</a>
    </div>
</div>

        </div>
    </nav>
</header>
