Forums

[resolved] Add a custon id to the ul in the menu (8 posts)

  1. cloix
    Member
    Posted 1 year ago #

    Hi guys! This is my first topic here!
    when a call the function wp_nav_menu() i get this code

    <div id="menu">
       <ul>
         <li>
         .
         .
         .

    Actually i need this scenario

    <ul id="my-menu">
        <li>
        .
        .
        .

    How can i remove di div wrapper and set an id to the
    ul tag?? Thanks!!

  2. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

    Trust the Codex. The Codex is your friend.
    http://codex.wordpress.org/Function_Reference/wp_nav_menu

  3. CyberAlien
    Member
    Posted 1 year ago #

    wp_nav_menu(array('menu_class' => 'my-menu', 'container' => false))

    edit: doh, wasn't fast enough.

  4. cloix
    Member
    Posted 1 year ago #

    thanks for the reply!
    esmi i've read the wp_nav_menu from codex but i haven't understand how to do my trick. Can you explain me what i have to do?

  5. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

    Look at the Parameters section of that page. There's a container parameter that you can use to suppress the enclosing div and a menu_class parameter that you can use to define the class of the ul.

  6. cloix
    Member
    Posted 1 year ago #

    So i have to tri this code
    wp_nav_menu( array( 'container' => '', 'menu_class' => 'my-menu' ) );
    it's ok? i can't try at this moment!

  7. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

    Vjacheslav Trushkin gave you the answer above. :-)

  8. cloix
    Member
    Posted 1 year ago #

    Ouch!!! i'm sorry but i haven't see that topic!! Thanks a lot!!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.