1
votes

I'm Currently Making a Header and Footer in Wordpress.

When I use wp_nav_menu and use the theme location primary. I'm trying to grab the header. Which i've set to primary in functions.php.

However it ends up displaying my footer.

I've also set the display location to "header" in menus. Am i missing something?

header.php

<?php 
             wp_nav_menu( array(
             "theme-location" => "primary",
             "container" => "ul",
             "menu_class" => "navbar-nav mr-auto"
                        ));

?>

functions.php

 function kraken_theme_setup(){

        add_theme_support( "menus" );

        register_nav_menu( "primary", "Primary Header Navigation" );
        register_nav_menu( "secondary", "Footer Navigation");
    }
    add_action( "after_setup_theme", "kraken_theme_setup" );
1
Did you attached the menu to the primary location in your WordPress admin ?Alexis Vandepitte
What do you mean ?Ryan Hinchliffe
When you go to appearance -> menu -> then select the menu of your choice. Go at the bottom, you should check the location you want your menu to be associated with. In your case in your header menu you should check "Primary Header Navigation"Alexis Vandepitte
I did say i'd done that "I've also set the display location to "header" in menus."Ryan Hinchliffe
Oups, didn't read that sorry.Alexis Vandepitte

1 Answers

0
votes

You have a typo in your wp_nav_menu arguments.

theme-location should be theme_location with _

Everything seems ok except that.