• I’m attempting to register multiple menus: one for ENGLISH and one for ITALIAN.
    I’m following the codex for registering menus. The Forever theme explicitly states it uses wp_nav_menu() in one location.
    What exactly should I be concerned with while attempting to register multiple menus to override the theme settings?
    Also is there a keen method for editing the file nav-menu.php (if necessary) in order to preserve its file stucture within the folder wp-includes?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter webeck

    (@webeck)

    Forever’s functions.php

    /**
    * This theme uses wp_nav_menu() in one location.
    */
    register_nav_menus( array(
    	'primary' => __( 'Primary Menu', 'forever' ),
    	) );

    I replace with:

    function register_my_menus() {
      register_nav_menus(
        array(
          'italian-menu' => __( 'Italian Menu' ),
          'english-menu' => __( 'English Menu' )
        )
      );
    }
    	add_action( 'init', 'register_my_menus' );

    I upload using a theme-child and everything from my site disappears including the dashboard. I am only able to log-in or view if I delete the functions.php from my child-theme. As far as I can tell I’m doing this step correctly. I suspect that perhaps this theme doesn’t encourage this type of modification?

    Yet again the nav-menu.php states:

    /**
     * Register navigation menus for a theme.
     *
     * @since 3.0.0
     *
     * @param array $locations Associative array of menu location identifiers (like a slug) and descriptive text.
     */
    function register_nav_menus( $locations = array() ) {
    	global $_wp_registered_nav_menus;
    
    	add_theme_support( 'menus' );
    
    	$_wp_registered_nav_menus = array_merge( (array) $_wp_registered_nav_menus, $locations );
    }

    I’m not sure what to do at this point, this really holds the last great obstacle from officially launching my site. I have the latest installment of WordPress (3.8.1) so register_nav_menu should work fine…

    [no bumping, please]

    Thread Starter webeck

    (@webeck)

    I would like to allow the Forever theme to be able to support multiple menus. Is this possible??

    Thread Starter webeck

    (@webeck)

    I would like to allow the Forever theme to be able to support multiple menus. Is this possible??

    Thread Starter webeck

    (@webeck)

    this makes it work, at least for now…

    Moderator Kathryn Presner

    (@zoonini)

    Hi there, instead of defining a new menu function in your child theme, I think you need to overwrite the existing function by reusing the same name.

    Could you try putting this in functions.php in your child theme:

    <?php
    /**
    * Two menu locations
    */
    	register_nav_menus( array(
    		'primary' => __( 'Italian Menu', 'forever' ),
    		'secondary' => __( 'English Menu', 'forever')
    	) );
    ?>

    I did this and it gave me two menu locations in my admin area under Appearance > Menus > Manage Locations.

    Let me know how it goes.

    Thread Starter webeck

    (@webeck)

    For some reason my admin area & site disappear when I alter the functions.php.

    I even deactivated all of my plug-ins to see if it was interfering.

    The only thing that has worked is this plug-in.

    One thing I haven’t tried yet was to update my current version 3.8.1 with the maintenance update. According to my admin dashboard I have the most recent version installed, and future security updates will be applied automatically.

    Moderator Kathryn Presner

    (@zoonini)

    I’m glad you found a plugin that does the trick. Updating WordPress shouldn’t make a difference in this case.

    For some reason my admin area & site disappear when I alter the functions.php.

    Are you modifying the original functions.php or putting the code I gave you in a blank file called functions in your child theme?

    If you put it in the child theme folder, could you double-check that the file is in plain-text format? What program did you use to create the file?

    If you’d like to troubleshoot further, could you provide a link to your site?

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘multiple navigation menus’ is closed to new replies.