WordPress.org

Ready to get started?Download WordPress

Forums

WordPress 3.0 Custom Menu (3 posts)

  1. cyberfanatic
    Member
    Posted 2 years ago #

    Hi,

    I'm currently running a website and would like to move to WordPress due to the fact that my website's content keeps growing each and every day and it is becoming very hard to actually keep up with everything. So I have decided to build myself a custom WordPress theme. For a beginner I am actually doing pretty good. I am done with the whole theme. All that is left is the menu and it is killing me.

    1) I want two menus. The first menu should just give me the unordered list. But for some reason WordPress gives all these classes and all that for no apparent reason. The only class I need is current-page-item.

    2) The second menu is a bit more complicated. For this menu as like the menu above all I want is just to grab the unordered list it should have no id and neither should the unordered list have a div wrapping around it and if it should have a div I would prefer it to be html5 nav wrapping around the unordered list. Also I want to add custom css classes to all the list items. Like so for all li tags they should all have the tags cat-item and then they should have item-100 and for each
    additional li tag that there is item-100 should switch to item-101 and so fourth. Also for the list item that contains a drop down I would like to place a span tag inside the a tag but after the text.

    Can anyone please help me? Would be greatly appreciated.

  2. Andrew
    Forum Moderator
    Posted 2 years ago #

    1)

    The first menu should just give me the unordered list.

    Which it does, using the wp_nav_menu() function
    http://codex.wordpress.org/Function_Reference/wp_nav_menu
    If classes are redundant, don't worry about it, they're there just-in-case you need them.

  3. Andrew
    Forum Moderator
    Posted 2 years ago #

    2)
    You can use the same wp_nav_menu() function, but use a 'custom menu' built through Appearance > Menu
    http://codex.wordpress.org/Appearance_Menus_Screen

    Call it through wp_nav_menu() http://codex.wordpress.org/Function_Reference/wp_nav_menu#Targeting_a_specific_Menu

    For the wrapping HTML5 element, try using 'container' => 'nav' as one of the wp_nav_menu() arguments.

Topic Closed

This topic has been closed to new replies.

About this Topic