WordPress wp_nav_menu skipping items OR not sorting items
-
I have a menu like this (called “Meny”):
Level1 ... - Level2 - ... - Level 3 - Level 3 .. and so on.However doing this in sidebar-menu.php:
$options = array( 'container' => '', 'echo' => false, 'menu' => 'Meny', 'theme_location' => 'sidebar-menu', ); $nav = wp_nav_menu($options);Outputs all level1 and level2 items but always only the first level3 child??? I’ve double checked and I do have several level3 items in “Meny”.. :S
If I remove ‘menu’ => ‘Meny’ it outputs all but then I loose the correct order!
-
What theme are you using? Where did you download it from?
I downloaded it from my brain… No it’s a theme based on:
http://ww.wp.xz.cn/themes/responsive but me and my collegue has rewritten some of it, mostly front-end changes.I doubt it has anything to do with the theme. The page-menu is showing correctly in the site.
header.php has this code:
<?php wp_nav_menu(array( 'depth' => 2, 'container' => 'div', 'theme_location' => 'header-menu', 'before' => '<div class="a_wrap">', 'after' => '</div>', 'menu' => 'Meny', 'items_wrap' => '<ul id="%1$s" class="%2$s"> <li id="menu_start" class="menu-item"> </li>%3$s <li id="menu_drift" class="menu-item"> <div class="a_wrap"> <a href="http://example.com">hardcoded tab</a> </div> </li> </ul>', ) ); ?>What happens if you use the original Responsive theme? If you want 3 levels, why are you setting
depthto 2?I want 2 levels (depths) in the main site-menu (header.php) but we also have a side-menu in (sidebar-menu.php) which we want to show 3 levels.
So which one relates to the code above?
Seems like the first menu is cached and used when wp_nav_menu is called the second time. It’s weird it outputs the first level 3 childs though.
I used wp_get_nav_menu_object() instead and that worked!
The topic ‘WordPress wp_nav_menu skipping items OR not sorting items’ is closed to new replies.