Add menu classes for each level (4 posts)

  1. Timmito
    Posted 4 years ago #

    Hey everybody,

    I've got a quite complex navigation menu that needs some ul classes to display properly. The navigation consists of nested lists. I know how to target each level within css (ul li ul li) dependant on their position. What I really need is to add a class to the uls on the same level. I want to use the default wordpress nav, so no custom menu required.
    1st level ul (class="level1")
    2nd level ul (class="level2")

    You might ask why! The thing is that this will be a mega menu combined with a flyout. And there will be images on different navigation levels (e.g. first level, second level) based on the hierarchy.

    Thanks in advance!


  2. vtxyzzy
    Posted 4 years ago #

    Here is a short article with a link to a tutorial on using a Walker class to modify a WP menu:


  3. Timmito
    Posted 4 years ago #

    Hey, thanks for your reply...

    Unfortunately I was not able to figure this out with a custom Walker class. But I found a solution to my question with class names:


    I am currently using it in the project. But there's one requirement that brings me back to your tutorial link. I need to add the post thumbnail and excerpt of a page to my wp_nav_menu. But only, if there's no subpage for that item.

    Maybe any idea?



  4. vtxyzzy
    Posted 4 years ago #

    No, sorry!

Topic Closed

This topic has been closed to new replies.

About this Topic