WordPress.org

Ready to get started?Download WordPress

Forums

Multiple custom menus - WP 3.0 (3 posts)

  1. andytford
    Member
    Posted 3 years ago #

    I am sure this topic is somewhere in this forum, however, I am unable to locate. I simply would like to add multiple menus, but am having difficulty with the syntax. I attempted to use the following - which failed.

    if ( function_exists( 'wp_nav_menu' ) ){
    
    	if (function_exists('add_theme_support')) {
    
    		add_theme_support('nav-menus');
    
    		add_action( 'init', 'register_my_menus' );
    
    		function register_my_menus() {
    
    			register_nav_menus(
    
    				array(
    
    					'main-menu' => __( 'Main Menu' )
    					'utility-menu' => __( 'Utility navigation' )
    
    				)
    
    			);
    
    		}
    
    	}
    
    }
  2. vytaulla51
    Member
    Posted 3 years ago #

    Hi:
    I'm a newbie so I maybe I'm wrong, but I was just asking about menus/navbars yesterday and here's what I learned.

    WP 3.0 now has menu building capabilities accessible through the admin:
    Appearance > menus. It allows for multiple menus.

    I designed my own theme so I had to "enable" menus. What you might have right now is the message that your theme isn't set up to work with the menus admin or words to that effect. That's what I had.

    I followed the instructions from here:

    http://codex.wordpress.org/Navigation_Menus

    and added the code to my functions.php and to relevant templates.

    I'm building one main menu, then have a secondary menu for just blog related items (my site is a business site with a blog, not a blog with some static pages). So my second menu is going into a second sidebar just on blog related pages. I've used widgets for that menu and it's interacting just fine with my main menu.

    Now I have to figure out the proper way to use the options IN the admin - menu, to style my navbar, but that's another issue. I'll be posting that question.

    Hope this gets you started!

  3. vytaulla51
    Member
    Posted 3 years ago #

    Oops, I was so happy to be able to help someone that I didn't really read closely enough...

    It looks like you're already aware of the menu functionality and are just trying to get the function to work.

    FWIW, here's what I used:

    function register_my_menus() {
    register_nav_menus(
    array(
    'navbar-menu' => __( 'Navbar Menu' ),
    'blog-menu' => __( 'Blog Menu' ))
    );
    }
    
    add_action( 'init', 'register_my_menus' );

    Is that what you need?

Topic Closed

This topic has been closed to new replies.

About this Topic