<?php 
// Security check
defined('ABSPATH') || die();
?>

<!-- ******************* The Navbar Area ******************* -->
<div id="wrapper-navbar" itemscope itemtype="http://schema.org/WebSite">

<a class="skip-link sr-only sr-only-focusable" href="#content"><?php esc_html_e( 'Skip to content', 'masterpiece' ); ?></a>

<nav class="navbar navbar-expand-md">

<?php if ( 'container' == $container ) : ?>
    <div class="container" >
<?php endif; ?>
            <!-- Your site title as branding in the menu -->
            <?php if ( ! has_custom_logo() ) { ?>

                <?php if ( is_front_page() && is_home() ) : ?>

                    <h1 class="navbar-brand mb-0"><a rel="home" href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" itemprop="url"><?php bloginfo( 'name' ); ?></a></h1>

                <?php else : ?>

                    <a class="navbar-brand" rel="home" href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" itemprop="url"><?php bloginfo( 'name' ); ?></a>

                <?php endif; ?>


            <?php } else {
                the_custom_logo();
            } ?><!-- end custom logo -->

        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="<?php esc_attr_e( 'Toggle navigation', 'masterpiece' ); ?>">
            <i class="fa fa-bars navbar-toggler"></i>
        </button>

        <!-- The WordPress Menu goes here -->
        <?php wp_nav_menu(
            array(
                'theme_location'  => 'primary',
                'container_class' => 'collapse navbar-collapse',
                'container_id'    => 'navbarNavDropdown',
                'menu_class'      => 'navbar-nav ml-auto',
                'fallback_cb'     => '',
                'menu_id'         => 'main-menu',
                'depth'           => 2,
                'walker'          => new Masterpiece_WP_Bootstrap_Navwalker(),
            )
        ); ?>
    <?php if ( 'container' == $container ) : ?>
    </div><!-- .container -->
    <?php endif; ?>

</nav><!-- .site-navigation -->

</div><!-- #wrapper-navbar end -->
