Running number on wp_nav_menu() generated menus

  1. SanktPille

    wp_nav_menu() is great and certainly a step up from wp_list_pages(). It adds a good deal of classes to the generated <li> tags, with the help of which menus can be styled quite well.

    That being said, I am missing one feature:

    Amongst others, the <li> tags are given a a class menu-item-xx, where xx is the post or page ID of the linked content. I'd like to have another numbered class, that is just a running number, with which menu items can be styled individually similar to using an :nth-child() css selector.

    When styling menu items individually by the current (and only) individual class, css needs to be adjusted when adding or removing an item as well as when changing menu order. The other option is actually using :nth-child(), but that does not work in IE 8, FF 3, Safari 2 and Opera 9.2 (and below, respectively).

    I don't really have a proposal for naming that class, since the intuitive one (i.e. menu-item-xx) is used already. Maybe menu-item-running-xx or the like might be an option.

    Posted: 8 years ago #
  2. jana26


    Need this too.

    Posted: 6 years ago #
  3. apktrendz

    I have done this code nth-child() on my apktrendz, but i got an error in line 12 parsing code ?

    Posted: 11 months ago #

RSS feed for this topic


You must log in to post.

  • Rating

    8 Votes
  • Status

    This idea is under consideration