WordPress.org

Ready to get started?Download WordPress

Forums

More than 1 menu, but not hierarchy (6 posts)

  1. andreand
    Member
    Posted 3 years ago #

    Hi folks,

    I'm designing a website using WordPress.

    I'd like to add another menu, I mean, a new menu, but independent of the primary menu. So, the secondary menu isn't what I'm searching for.

    I'd be thankful find some information about.

    I only found information about a secondary menu that depends on the primary, you know ...

    Could someone help me, please?

    Thanks a lot!

  2. esmi
    Forum Moderator
    Posted 3 years ago #

    You can add as many independent menus/sidebars as you want - each called using get_sidebar.

  3. andreand
    Member
    Posted 3 years ago #

    Thanks a lot, esmi!

    However, I don't know how to do it ... I need more information, please.

    What I'd like to do is:
    http://www.nomondesign.com/test/wp_multiplemenus.jpg

    My theme is called "twentyten".

    I wrote this code in functions.php:

    // This theme uses wp_nav_menu() in one location.
    register_nav_menus( array(
      'primary' => __( 'Primary Navigation', 'twentyten' ),
      'secondary' => __( 'Secondary Navigation', 'twentyten' ),
    ) );

    and in header.php:

    <div id="menu_adicional">
      <?php wp_nav_menu( array( 'theme_location' => 'secondary-menu', 'menu_class' => 'secondary', 'fallback_cb' => '') ); ?>
    </div>
    
    <div id="menu_principal">
      <?php wp_nav_menu( array( 'theme_location' => 'primary-menu', 'menu_class' => 'primary', 'fallback_cb' => '') ); ?>
    </div>

    But, it doesn't work ...

    Could you help me please? You can see the image:
    http://www.nomondesign.com/test/wp_multiplemenus.jpg

    Thanks a lot!

  4. Digital Raindrops
    Member
    Posted 3 years ago #

    The theme locations are primary and secondary, not 'primary-menu' and 'secondary-menu'.

    <div id="menu_adicional">
      <?php wp_nav_menu( array( 'theme_location' => secondary', 'fallback_cb' => '') ); ?>
    </div>
    
    <div id="menu_principal">
      <?php wp_nav_menu( array( 'theme_location' => 'primary', 'fallback_cb' => '') ); ?>
    </div>

    menu_class, defaults to 'menu', and it relates to the style.css block for the menu's, however if you are using an id and not class, you would style as id not class.

    'fallback_cb' => '', will only output a menu if it has been created and assigned to the Menu Location

    The Second Menu, with different styling, a twenty ten tutorial.

    Add a third menu in the footer area, a twenty ten tutorial.

    HTH

    David

  5. esmi
    Forum Moderator
    Posted 3 years ago #

    I can't see what's wrong with your current code.

  6. andreand
    Member
    Posted 3 years ago #

    Esmi, thanks for your help!

    David, thanks a lot! I'll read the tutorial that you send me. It's exactly what I'm searching for!! :) So, I expect it solve my problem!

    I'll save to my Delicious, too!

    Thanks!!

Topic Closed

This topic has been closed to new replies.

About this Topic