• Hi!
    I need to create a second left menu in the header. It does not work for me.
    I have created a childtheme. I tried to override by copy the orginal file (ini-base.php ) and created the same folder (core) in the childtheme and put the file there.
    I added under the section below and called the extra menu to mainleft, as you can se below.

    /*
    * hook : after_setup_theme
    */
    function czr_fn_register_menus() {
    /* This theme uses wp_nav_menu() in one location. */
    register_nav_menu( ‘main’ , __( ‘Main Menu’ , ‘customizr’ ) );
    register_nav_menu( ‘mainleft’ , __( ‘Mainleft’ , ‘customizr’ ) );
    register_nav_menu( ‘secondary’ , __( ‘Secondary (horizontal) Menu’ , ‘customizr’ ) );
    if ( CZR_IS_MODERN_STYLE ) {
    register_nav_menu( ‘topbar’ , __( ‘Horizontal Top Bar Menu. (make sure that the topbar is displayed in the header settings ).’ , ‘customizr’ ) );
    register_nav_menu( ‘mobile’ , __( ‘Mobile Menu’ , ‘customizr’ ) );
    }
    }
    But the locations does not show up in admin at apperance > menus. What more do I need to do?

Viewing 1 replies (of 1 total)
  • Hi there,
    from the theme functions.php file you can see that the core/init-base.php is required from the template directory (not the stylesheet one) hence, that file, you cannot override it in the child-theme.
    Also, you don’t need to override that file to register a new nav menu (as you don’t alter a theme menu, you just add a new one).

    You can register your nav menu just adding the relevant code do your child-theme functions.php

    See the example in the codex:
    https://codex.ww.wp.xz.cn/Function_Reference/register_nav_menu

    Hope this helps.

Viewing 1 replies (of 1 total)

The topic ‘Adding a new menu location’ is closed to new replies.