Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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 at 15:53

1 Answer 1

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:

<?php 
     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

 
discard

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.