count wp_nav_menu items
-
Hey there,
I want to fit the menu differently to the layout depending on how many first level items it got.
So i just tried to count them, but my script always returns 0.$wp_nav_menu_to_count = wp_nav_menu( array( 'echo' => 'false', 'depth' => '1' ) ); $wp_nav_menu_counter = substr_count($wp_nav_menu_to_count, 'menu-item'); echo $wp_nav_menu_counter;
It worked likewise with wordpress 2.9, but i used a get function there.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘count wp_nav_menu items’ is closed to new replies.