• Resolved SooperGenius

    (@soopergenius)


    Hi. I’m trying to put a fairly standard navigation menu in the header part of my site. I’ve put the following code in the functions.php file of the theme…

    add_theme_support("nav-menus");
    function custom_navigation_menus() {
        $locations = array(
            'header-menu' => __( 'Main Navigation', 'text_domain' ),
        );
        register_nav_menus( $locations );
    }
    add_action("init", "custom_navigation_menus");

    And I put this code in my header.php file…

    <?php wp_nav_menu(
        array(
            "theme-location"	=> "header-menu",
            "container" 		=> "div",
            "container_class" 	=> "standard-font",
            "container_id" 		=> "header-menu",
            "items_wrap" 		=> "<ul>%3$s</ul>",
            "after" 			=> " | "
        )
    ); ?>

    The menu is showing up just fine but without the customized container_class, container_id, etc. It’s spitting out the standard mark-up. Before anyone mentions it, I know I could simply apply CSS to the standard mark-up but I’d like to know what I’m doing wrong here for my own enlightenment.

Viewing 9 replies - 1 through 9 (of 9 total)
  • "theme_location" => "header-menu",
    Notice that I changed – with an underscore on theme location so it reads theme_location.

    Moderator Jose Castaneda

    (@jcastaneda)

    THEME COFFEE MONKEY

    Are you using the correct theme location? It should be theme_location and not theme-location. That is what I’m guessing just by looking at the code.

    Thread Starter SooperGenius

    (@soopergenius)

    Thanks, guys. You are correct that I had mistyped the “theme_location”. However, correcting that problem doesn’t actually fix the issue. It still doesn’t add the “id” or “class” to the container or anything else. If someone wants, I can put the zip file with the theme somewhere. I’m perfectly willing to let folks look at my code. I just didn’t want to clutter the forum with crap-tons of code.

    Andrew

    Jam Viet

    (@mcjambi)

    Sometime i have the same mistyping like dash and underscore.

    Moderator Jose Castaneda

    (@jcastaneda)

    THEME COFFEE MONKEY

    You can also use gist.github.com if you want.

    Thread Starter SooperGenius

    (@soopergenius)

    Gist is quite cool. I’ve put the relevant code in there, I think. If you need something else put in, let me know.

    https://gist.github.com/AndrewECooper/9970622

    Andrew

    Moderator Jose Castaneda

    (@jcastaneda)

    THEME COFFEE MONKEY

    It’s the items_wrap that is causing that. You haven’t declared the id or the class in the ul. I’m surprised I missed that. Lol.

    and I also commented in your gist. πŸ˜‰

    Thread Starter SooperGenius

    (@soopergenius)

    Thanks for the help guys!

    Moderator Jose Castaneda

    (@jcastaneda)

    THEME COFFEE MONKEY

    Of course! Happy to help however we can. πŸ™‚

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘wp_nav_menu() not customizing output.’ is closed to new replies.