Getting rid of Menu ID in Wordpress 3.0

Discussion in 'HTML & Website Design' started by blues44, Jul 25, 2010.

  1. #1
    Hey all
    I am working with the navigation bar in Wordpress 3.0 and have to get rid of the
    'menu_id'=> '' section of this code.
    <?php wp_nav_menu( array('menu' => 'Main', 'container' => '' , 'menu_class' => '', 'menu_id'=> '' )); ?>
    As you can see I have it set to nothing but its still coming up in the code. Does anyone know how I can override this so I can get this the nav 3.0 to work?

    Thanks
     
    blues44, Jul 25, 2010 IP
  2. blues44

    blues44 Peon

    Messages:
    65
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    How can I override the menu_id or nullify it?
     
    blues44, Jul 26, 2010 IP
  3. Cash Nebula

    Cash Nebula Peon

    Messages:
    1,197
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    0
    #3
    According the Codex, you can delete menu_id because it's optional.

    <?php wp_nav_menu( array('menu' => 'Main', 'container' => '', 'menu_class' => '')); ?>
    Code (markup):
     
    Cash Nebula, Jul 26, 2010 IP
  4. blues44

    blues44 Peon

    Messages:
    65
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Ya but when I do that it automatically put it in, if you did that it would show up if you view the source
     
    blues44, Jul 26, 2010 IP
  5. Cash Nebula

    Cash Nebula Peon

    Messages:
    1,197
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Do you mean <ul id='menu-menu'> ? I think that is the default menu list.
    It appears whenever there is a custom menu, even if it has no menu items. I had to delete the menu name to get rid of it.

    However, wp_nav_menu defaults to wp_page_menu when there is no custom menu, unless you specify no callback function with 'fallback_cb' => ''

    <?php wp_nav_menu( array('menu' => 'Main', 'container' => '', 'menu_class' => '', 'fallback_cb' => '')); ?>
    Code (markup):
     
    Last edited: Jul 26, 2010
    Cash Nebula, Jul 26, 2010 IP
  6. blues44

    blues44 Peon

    Messages:
    65
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I used your code Cash Nebula and it still isnt working
    this code <ul id="menu-main"> is still somehow is sneaking into the coding.
    THis is what I need to get rid of because it is preventing the menu from showing up
     
    blues44, Jul 26, 2010 IP
  7. Cash Nebula

    Cash Nebula Peon

    Messages:
    1,197
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    0
    #7
    So much for being optional! :rolleyes: The ID always appears if a menu is selected and there is no class name.
    To get rid of the ID, either use a class name or select no menu in the "Primary Navigation" dropdown.

    I will try a few other things to see if I can make it go away.
     
    Cash Nebula, Jul 27, 2010 IP
  8. blues44

    blues44 Peon

    Messages:
    65
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    That is stupid of WP! The menu_id is preventing my navigation bar from working!
    There has to be a way to override or void it. Thanks for the help.
    When I use a class name the menu_id still pops up
    Where is the Primary Navigation dropdown?
     
    blues44, Jul 27, 2010 IP