=== Codepress Menu === Contributors: davidmosterd,tschutter Tags: wordpress, menu, submenu, walker, navigation, nav, php, code Requires at least: 3.1 Tested up to: 3.4.2 Stable tag: 2.2 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html Allows you to display a sub-menu, it's depth from there on and gives you good control over the menu-item classes. == Description == Uses the native [wp_nav_menu()](http://codex.wordpress.org/Function_Reference/wp_nav_menu) with a few more possibilities. No configuration required but it adds a few runtime parameters that can be used to tweak your menu. This will get the first sub-menu from the current branch and 2 levels beyond (menu + sub-menu + sub-menu): ` wp_nav_menu( array( 'level' => 2, 'depth' => 3 )); ` Show the whole current branch only: ` wp_nav_menu( array( 'level' => 1 )); ` Aimed on simple use on various use cases: ` // display first level in the header wp_nav_menu( array( 'depth' => 1 )); // display first sub-menu from the current branch somewhere else wp_nav_menu( array( 'depth' => 2, 'level' => 2 )); ` For those who like a some control on the CSS classes: * *sanitize* Keep only a few WordPress classes (li.current-menu-item, li.current-menu-parent, li.current-menu-ancestor) and add li.first and li.last. * *simple* Use even more simple classes (li.current, li.current-parent, li.current-ancestor) and add li.first and li.last. * *minimal* Same as simple, but without list.first and li.last because you target modern browsers only or use something like selectivizr * *false* Do nothing (default) Use the filter 'codepress_menu_filter_classes' to define your own class filter. ` wp_nav_menu( array( 'classes' => 'sanitize' )); ` == Upgrade Notice == = 2.2 = We have kept it backwards compatible as much as possible, but there might have been a few sacrifices here and there. They should be minor though. = 2.1 = The changes from 2.0 to 2.1 are significant as it abandons the use of a custom function. A good step forward, but check the examples before you upgrade. == Installation == Search for `codepress menu` as described in the [Codex](http://codex.wordpress.org/Managing_Plugins#Installing_Plugins) or 1. Upload codepress-menu to the `/wp-content/plugins/` directory 1. Activate the plugin through the 'Plugins' menu in WordPress Now you can use wp_nav_menu() with enhanced super-powers ;) == Changelog == = 2.2 = * Bugfix: level set higher then 2 sometimes gave incorrect results. * Recoded it to match the WordPress coding standards (hope we managed to do this). * The items no longer have a separate class. It was not needed after all and this is more of a WordPress approach. * Added a filter (codepress_ignore_theme_locations) to tell the plugin not to apply on certain theme locations. * Removed some hooks that could only cause unwanted behavior and mostly targeted the separate item class (codepress_menu_return_false_on_empty_list_after_filters, codepress_menu_filter_classes, codepress_menu_items, codepress_menu_set_walker, codepress_menu_item_sanitize_classes). * Allowed the item-id. We see no harm in it after all. (codepress_menu_item_sanitize_id) = 2.1.2 = * Now checks if the filters have not reduced the amount of items to zero. If so, act as wp_nav_menu and return false. * When a theme location is used in conjunction with the plugin, it now returns an empty string. = 2.1.1 = * 'sanitize' option is replaced by 'classes' and now defaults to doing nothing. Choosing 'simple' as option will result in what the default sanitize did in the 2.0 version. = 2.1 = * Now hooks into the native wp_nav_menu() and abandons the use of a custom function. * Extends the Walker_Nav_Menu class and most of it's filters and functions are used to keep as close to the WordPress core as possible. * You can no longer fetch an array of items and apply filters on it as you see fit. This functionality may return, but the focus of this version was on integration with wp_nav_menu(). = 2.0 = * Initial public release.