WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] wp_nav_menu() not customizing output.

[Resolved] wp_nav_menu() not customizing output.

  • 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)
Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘[Resolved] wp_nav_menu() not customizing output.’ is closed to new replies.