<?php get_header(); ?>

<script type="text/javascript">
    if (navigator.browserLanguage)
        var language = navigator.browserLanguage;
    else
        var language = navigator.language;


    // cas particulier du chinois (code lang détecté différent du code WPML)
    if (language.indexOf('zh') > -1) document.location.href = 'zh';
    <?php
    $languages = icl_get_languages('skip_missing=0');
    foreach ($languages as $l) {
        echo "else if (language.indexOf('" . $l['language_code'] . "') > -1) document.location.href = '" . $l['language_code'] . "';";
    }
    ?>
</script>

<main class="languages">
    <div class="wrap">
        <img src="<?php bloginfo('template_url'); ?>/dist/assets/img/logo-laurentperrier-big-trans.png" alt="Champagne Laurent Perrier" class="logo">
        <p>
            Please, select your language :
        </p>
        <nav>
            <ul class="home-main-nav-list vertically-centred">
                <?php
                $languages = icl_get_languages('skip_missing=0');
                foreach ($languages as $l) {
                    echo "<li>";
                    echo '<a href="' . $l['url'] . '">';
                    echo $l['native_name'];
                    echo '</a>';
                    echo "</li>";
                }
                ?>
            </ul>
        </nav>
    </div>
</main>

<!-- WP-Minify JS -->

<?php wp_footer(); ?>

</body>

</html>