WordPress Menu Not Showing Up

I am developing a bespoke WordPress Theme for a client and I cannot get the WP Menu to show up on any page (including the Home) and posts!

On the admin backend under apperance > menus it works perfectly!
I am also using the exact same wp_menu array I have used in all of my themes. Here is the code in my header.php file

Read More
<div id="menu">
    <nav class="top-links" role="navigation">
        <?php
            wp_nav_menu(array(
                'menu'              => 'primary',
                'theme_location'    => 'primary',
                'depth'             => 2,
                'container'         => 'div',
                'container_class'   => 'top-links-nav',
                'fallback_cb'       => 'wp_bootstrap_navwalker::fallback',
                'walker'            => new wp_bootstrap_navwalker())
            );
        ?>
    </nav>
</div>

and here is the code in the function.php file…

/* Register the Nav Menu */
function register_my_menus() { 
    require_once('wp_bootstrap_navwalker.php');
    register_nav_menus(array( 
        'primary' => _( 'Primary Menu' ), 
        'header-top-menu' => _( 'Header Top Menu' ) 
    )); 
    } 
add_action( 'init', 'register_my_menus' ); 
/* End the Nav Menu */

I am using version 4.1.1 of WordPress and I have cot all my files commented correctly! I know this code does work so have no idea why it’s not on this!

Related posts

Leave a Reply

2 comments

  1. A reduced test case should get you started:

    <?php if ( has_nav_menu( 'primary' ) ) { ?>
        <?php wp_nav_menu( array( 
            'container' => 'div', 
            'container_class' => 'top-links-nav', 
            'theme_location' => 'primary' ) ); 
        ?> 
    <?php } else { ?> 
        <h1>No Primary Menu</h1> 
    <?php } ?>