<?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="<?php echo get_template_directory_uri(); ?>/assets/img/favicon.webp"/>
    <meta property="og:type" content="product">
    <meta property="og:title" content="WareGo">
    <meta property="og:url" content="<?php echo get_permalink();?>">
    <meta property="og:image" content="https://warego.co/wp-content/uploads/2025/02/banner-center-img-1.webp">
    <meta property="og:description" content="WareGo empowers businesses to streamline warehouse operations and boost efficiency. Our advanced WMS offers a comprehensive solution for industries like retail, e-commerce, 3PL, cold storage, food & beverage, wholesale, manufacturing, and more. With features like real-time inventory tracking, automated order processing, and advanced analytics, we help you optimize your supply chain and drive growth through innovation.">
    <meta property="product:plural_title" content="WareGo">
    <meta property="product:price.amount" content="449">
    <meta property="product:price.currency" content="USD">
    <?php if(is_front_page()):?>
    <link rel="preload" href="<?php echo esc_url( get_template_directory_uri() . '/assets/img/support/support-banner.webp' ); ?>" as="image" type="image/webp" media="(min-width: 992px)">
    <link rel="preload" href="<?php echo esc_url( get_template_directory_uri() . '/assets/img/support/support-banner-mobile.webp' ); ?>" as="image" type="image/webp" media="(max-width: 767px)">
    <?php endif;?>
    <?php if(is_single()):?><link rel="preload" href="<?php echo esc_url( get_template_directory_uri() . '/assets/img/support-detail/banner-bg.webp' ); ?>" as="image" type="image/webp"><?php endif;?>


    <script>
        const ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>';
    </script>
	<?php wp_head(); ?>

    <?php

$page_schema = get_field('page_schema'); 


$global_schema = get_field('schema', 'option'); 

$schema = $page_schema ? $page_schema : $global_schema;

if ($schema) :
    if (strpos($schema, '<script') !== false) {
        // If schema already includes <script>, output as-is
        echo $schema;
    } else {
        // Else, wrap in <script> tag
        ?>
        <script type="application/ld+json">
        <?php echo $schema; ?>
        </script>
        <?php
    }
endif;
?>


    <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');
} */

?>


<!-- <div class="topbar"></div> -->
    <div class="progress-container">
        <div class="progress-bar" id="myBar"></div>
    </div>
<header>
    
    <nav class="navbar navbar-expand-lg main-header container">
        <div class="container-fluid px-0">
        <a class="navbar-brand" href="<?php echo explode('customer-support', home_url())[0]; ?>">
    
        <img src="<?php echo get_template_directory_uri(); ?>/assets/img/warego-logo.webp" class="img-fluid" alt="WareGo" loading="lazy">
   
</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>
            <?php
                    $nav_content = "";
                    $main_template_directory_path = ABSPATH . '../wp-content/themes/waregowp/navigations/';
                    if (file_exists($main_template_directory_path . 'navigation-data.txt')) {
                        $nav_content = file_get_contents($main_template_directory_path . 'navigation-data.txt');
                    }
                    
                    if (strlen($nav_content) < 100) {
                        $nav_content = file_get_contents(get_template_directory() . '/navigation-data.txt');
                    }

                    echo $nav_content;
                ?>
        </div>
    </nav>
</header>
