Tuesday, 20 August 2013

Is it possible to limit WordPress custom menus to only two levels?

Is it possible to limit WordPress custom menus to only two levels?

We are building a theme on WordPress 3.5.1 and we created two custom menus
- one for the header and one for the footer. When the users create the
menus they can add as many levels as they want, by indenting the menu
items once, twice or more. We want to limit the users to two levels only
(menu and submenu), so they will not be able to indent menu items more
than once. Is it possible? We also want to display only the first two
levels of the menu, so if the user indents menu items more than once -
they will be ignored. But it's more important to not allow the users to
create menus with more than two levels - indenting twice should not be
allowed. Is it possible?
We are using class themeslug_walker_nav_menu extends Walker_Nav_Menu and
<?php wp_nav_menu( array( 'theme_location' => 'footer_menu', 'walker' =>
new themeslug_walker_nav_menu ) ); ?> according to my previous question -
Is it possible to create custom menus in WordPress with titles without
links?
Thanks, Uri.

No comments:

Post a Comment