How to limit wordpress menu depth in admin panel

Follow up on @jmarceli’s and @squarecandy’s great answers. Here is a solution that allows for: Easier scaling (set an object in the php action) Updates to the correct menu depth when the location checkboxes are changed /** * Limit max menu depth in admin panel */ function limit_admin_menu_depth($hook) { if ($hook != ‘nav-menus.php’) return; wp_register_script(‘limit-admin-menu-depth’, … Read more

Menu Items Disappearing

The following has worked for some users with similar problem: Try to increase the value of the max_input_vars variable in php.ini. This variable was introduced in PHP version 5.3.9 and has the default value of 1000. You can read more about it in the PHP documentation: http://php.net/manual/en/info.configuration.php max_input_vars 1000 PHP_INI_PERDIR Available since PHP 5.3.9. How … Read more

Hide main div if wp_nav_menu is empty

Assign the menu to a string: $menu = wp_nav_menu( array ( ‘echo’ => FALSE, ‘fallback_cb’ => ‘__return_false’ ) ); if ( ! empty ( $menu ) ) { echo ‘<div class=”navmain2″>’ . $menu . ‘</div>’; }

Assign a Class to the Current “Tag” for Formatting

Add something like this to the functions file: function current_tag($tags) { global $wp_query; $cid = $wp_query->query_vars[‘cat’]; foreach($tags as $tag) { // match tagid to $cid } } add_filter( ‘get_the_tags’, ‘current_tag’); This won’t work by itself, but it will be a good start for getting the right information to the right place.

How to avoid wp_nav_menu() ID conflict?

The solution is not to call the same ‘theme_location’ more than once. Theme location is intended to represent an explicit location within the template. Just register a separate ‘theme_location’ for each separate location within the template that you want to display a nav menu. Consider your chosen ‘theme_location’ names to be semantic names, representing the … Read more