WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Wordpress horizontal line menu

Hi. I been fighting with this problem for couple of weeks now. Trying various approaches. From CSS styling to a custom walker.

I want to render each level as its own element. The navigation menu(defined in Appearence/Menu in Admin) consists of both Pages, Posts and WooCommerce products and categories.

When I'm on the homepage, I want to see LEVEL 1 Menu Objects. When I navigate to a LEVEL 1 page I wan't to show it's Children (LEVEL 2) in its own UL beneath the Top UL. If I navigate to a Child of LEVEL 1(level 2 object) I want to render its children as its own UL.

The picture attached shows this scenario where all the levels are shown. This, in the best of worlds, should not be dependent upon a specific number of levels though.

This should be a basic thing to accomplish but I fail horrendously - I'm new to WP / PHP ( coming from the .NET world )

Please help. Anything goes, pointer to a plugin, pure code, things to try ...

share|improve this question
Default WordPress menus render all elements. You then use CSS to hide/show. Classes like .current-menu-item and .current-menu-ancestor allow you to target submenus within those trees and give them different styles (like display: block; when the rest are hidden by default.) – Eric Holmes Jun 3 '14 at 15:53

You could use conditional statements to show the children. Depending on what your using to categorize the pages...

If you were using parent / children categories it would work something like this:

     if ( in_category( 'New Watches' )) {
          // show new watches menu
     } elseif ( in_category( array( 'Classic Watches' ) )) {
         // show classic watches menu
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.