<?php

/**
 * Header Layout 2
 *
 * @package NewsNation
 */

use newsnation\NewsNation_Walkernav;

$newsnation_default = newsnation_get_default_theme_options();
$newsnation_header_bg_size = get_theme_mod('newsnation_header_bg_size', $newsnation_default['newsnation_header_bg_size']);
$ed_header_bg_fixed = get_theme_mod('ed_header_bg_fixed', $newsnation_default['ed_header_bg_fixed']);
$site_title_add_layout = get_theme_mod('site_title_add_layout', $newsnation_default['site_title_add_layout']);
$ed_header_bg_overlay = get_theme_mod('ed_header_bg_overlay', $newsnation_default['ed_header_bg_overlay']);
$newsnation_header_bg_size = get_theme_mod('newsnation_header_bg_size', $newsnation_default['newsnation_header_bg_size']);
$ed_header_bg_fixed = get_theme_mod('ed_header_bg_fixed', $newsnation_default['ed_header_bg_fixed']);
?>


<header id="site-header" class="theme-header data-bg <?php if ($ed_header_bg_overlay) {
                                                            echo 'data-bg-overlay';
                                                        } ?> <?php if (get_header_image()) {
                                                                    if ($ed_header_bg_fixed) {
                                                                        echo 'data-bg-fixed';
                                                                    } ?> header-bg-<?php echo esc_attr($newsnation_header_bg_size); ?> <?php } ?>" data-background="<?php echo esc_url(get_header_image()); ?>" role="banner">
    <?php
    $newsnation_default = newsnation_get_default_theme_options();
    $ed_ticker_bar_social_nav = get_theme_mod('ed_ticker_bar_social_nav', $newsnation_default['ed_ticker_bar_social_nav']);
  ?>

    <div class="header-top-area">
        <div class="wrapper header-wrapper">
            <div class="header-item header-item-left">

                <div class="data-time-panel">
                    <div class="theme-navextras-item theme-navextras-date">
                        <span class="theme-navextras-icon"><?php newsnation_theme_svg('calendar-full'); ?></span>
                        <span class="theme-navextras-label"><?php echo esc_html(date('l, F jS, Y')); ?></span>
                    </div>
                    <div class="theme-navextras-item theme-navextras-clock">
                        <span class="theme-navextras-icon"><?php newsnation_theme_svg('clock'); ?></span>
                        <span class="theme-navextras-label"><span id="wpi-time-clock"></span></span>
                    </div>
                </div>
            </div>

            <div class="header-item header-item-right">

                <?php
                if (has_nav_menu('newsnation-social-menu') && $ed_ticker_bar_social_nav) { ?>
                    <div class="header-social-navigation">
                        <?php
                        wp_nav_menu(
                            array(
                                'theme_location' => 'newsnation-social-menu',
                                'link_before' => '<span class="screen-reader-text">',
                                'link_after' => '</span>',
                                'container' => 'div',
                                'container_class' => 'newsnation-social-menu',
                                'depth' => 1,
                            )
                        ); ?>
                    </div>
                <?php } ?>
            </div>
        </div>
    </div>

    <div class="header-branding-area">
        <div class="wrapper header-wrapper">
            <div class="header-item header-item-center">
                <div class="header-titles">
                    <?php
                    newsnation_site_logo();
                    newsnation_site_description();
                    ?>
                </div>
            </div>

        </div>
    </div>



    <div id="theme-navigation" class="header-navbar">
        <div class="wrapper header-wrapper <?php if (!is_active_sidebar('newsnation-offcanvas-widget')) { echo 'no-item-left'; } ?>">

            <div class="header-item header-item-left">

                <?php if (is_active_sidebar('newsnation-offcanvas-widget')) : ?>
                    <div id="widgets-nav" class="icon-sidr">
                        <button id="hamburger-one" class="navbar-control" >
                             <span class="screen-reader-text"><?php esc_html_e('Offcanvas Widgets', 'newsnation'); ?></span>
                            <span class="hamburger-wrapper">
                                <span class="hamburger-inner"></span>
                            </span>
                        </button>
                    </div>
                <?php endif; ?>

                <div class="site-navigation">
                    <nav class="primary-menu-wrapper" aria-label="<?php esc_attr_e('Horizontal', 'newsnation'); ?>" role="navigation">
                        <ul class="primary-menu theme-menu">
                            <?php
                            if (has_nav_menu('newsnation-primary-menu')) {
                                wp_nav_menu(
                                    array(
                                        'container' => '',
                                        'items_wrap' => '%3$s',
                                        'theme_location' => 'newsnation-primary-menu',
                                        'walker' => new newsnation\NewsNation_Walkernav(),
                                    )
                                );
                            } else {
                                wp_list_pages(
                                    array(
                                        'match_menu_classes' => true,
                                        'show_sub_menu_icons' => true,
                                        'title_li' => false,
                                        'walker' => new NewsNation_Walker_Page(),
                                    )
                                );
                            } ?>
                        </ul>
                    </nav>
                </div>
            </div>

            <div class="header-item header-item-right">
                <?php main_navigation_extras(); ?>
            </div>
        </div>
    </div>
</header>