Amy-Mir / header.php
header.php
Raw
<?php
/**
 * The header for our Theme
 *
 * Displays all of the <head> section and everything up till <div id="content">
 *
 */

// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;

$menuItems = get_field('menu_items','options');
$menuCover = get_field('mobile_menu_cover','options');
$socialMedia = get_field('social_media_links','options');

$menuListFull = array_merge($menuItems['first_menu_list'],$menuItems['second_menu_list']);

?>

<!DOCTYPE html>
<html lang="nb-NO">

<head>
    <meta charset="<?php bloginfo( 'charset' ); ?>">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="profile" href="http://gmpg.org/xfn/11">
    <link rel="preconnect" href="https://fonts.gstatic.com">
    <link href="https://fonts.googleapis.com/css2?family=Work+Sans:wght@400;600;700;800&display=swap" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@1,400;1,500;1,700&display=swap"
        rel="stylesheet">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.23/browser.min.js"></script>
    <?php wp_head(); ?>
    <!--  Designer & Frontend Developer: Rochdi Belhirch ( https://www.github.com/rush2di )  !-->
</head>

<body <?php body_class(); ?> >
    <div class="container">
        <nav class="nav__wrapper" role="navigation">
            <ul>
                <?php 
                foreach ($menuItems['first_menu_list'] as $item):
				$title = $item['menu_item_title'];
				$url = $item['menu_item_link'];
				?>
                <li>
                    <a href="<?php echo esc_attr( $url); ?>">
                        <?php echo esc_html( $title ); ?>
                    </a>
                </li>
                <?php 
                endforeach; 
                ?>
            </ul>

            <div class="nav__logo">
                <a href="/">
                    <img src="<?php echo get_template_directory_uri();?>/assets/EkspedisjonsJenta.svg"
                        alt="Ekspedisjons Jenta" />
                </a>
            </div>

            <ul>
                <?php 
                foreach ($menuItems['second_menu_list'] as $item):
				$title = $item['menu_item_title'];
				$url = $item['menu_item_link'];
				?>
                <li>
                    <a href="<?php echo esc_attr( $url); ?>">
                        <?php echo esc_html( $title ); ?>
                    </a>
                </li>
                <?php 
                endforeach; 
                ?>
            </ul>
        </nav>
        <div class="nav__wrapperMob">
            <button class="hamburger hamburger--spin" type="button" aria-label="Menu" aria-controls="navigation">
                <span class="hamburger-box">
                    <span class="hamburger-inner"></span>
                </span>
            </button>
            <div class="nav__fixedMob">
                <div class="nav__menuWrapper">
                    <div class="nav__menuHead">
                        <div class="hero__background">

                            <img alt="<?php echo esc_attr($menuCover['alt']); ?>" class="lazy"
                                src="<?php echo esc_attr($menuCover['sizes']['thumbnail']); ?>"
                                data-src="<?php echo esc_attr($menuCover['sizes']['large']); ?>" 
                                data-srcset="<?php echo esc_attr($menuCover['sizes']['medium']); ?> 300w,
                                <?php echo esc_attr($menuCover['sizes']['large']); ?> 768w,
                                <?php echo esc_attr($menuCover['sizes']['1536x1536']); ?> 1024w" data-sizes="100w" 
                                />

                            <div class="hero__overlayDynamic" aria-hidden="true"></div>

                            <div class="nav__logo">                            
                                <img src="<?php echo get_template_directory_uri();?>/assets/EkspedisjonsJenta.svg"
                                    alt="Ekspedisjons Jenta">
                            </div>
                        </div>
                    </div>
                    <nav class="nav__menuBody" role="navigation">
                        <ul>
                            <?php 
                            foreach ($menuListFull as $item):
                            $title = $item['menu_item_title'];
                            $url = $item['menu_item_link'];
                            ?>

                            <li class="nav__menuBodyItem">
                                <a href="<?php echo esc_attr( $url); ?>">
                                    <?php echo esc_html( $title ); ?>
                                </a>
                            </li>

                            <?php 
                            endforeach; 
                            ?>
                        </ul>
                    </nav>
                    <div class="nav__menuFooter">
                        <ul>
                            <li class="nav__menuBodyItem">
                                <a href="<?php echo esc_attr( $socialMedia['facebook'])?>" target='_blank'
                                    rel="noopener noreferrer">
                                    <span class="fab fa-facebook-square"></span>
                                </a>
                            </li>
                            <li class="nav__menuBodyItem">
                                <a href="<?php echo esc_attr( $socialMedia['instagram'])?>" target='_blank'
                                    rel="noopener noreferrer">
                                    <span class="fab fa-instagram"></span>
                                </a>
                            </li>
                            <li class="nav__menuBodyItem">
                                <a href="<?php echo esc_attr( $socialMedia['linkedin'])?>" target='_blank'
                                    rel="noopener noreferrer">
                                    <span class="fab fa-linkedin"></span>
                                </a>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <?php do_action( 'wp_body_open' ); ?>