mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-22 08:11:52 +01:00
Menus: Add filter to sub-menu class in nav menus.
Add new filter `nav_menu_submenu_css_class` to the `Walker_Nav_Menu::start_el()` method, allowing themers to modify the sub menu classes output by `wp_nav_menu()`. Props: csloisel, darthaud, raisonon. Fixes: #36163. Built from https://develop.svn.wordpress.org/trunk@40537 git-svn-id: http://core.svn.wordpress.org/trunk@40413 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
812ac18853
commit
717de16c68
@ -58,7 +58,22 @@ class Walker_Nav_Menu extends Walker {
|
|||||||
$n = "\n";
|
$n = "\n";
|
||||||
}
|
}
|
||||||
$indent = str_repeat( $t, $depth );
|
$indent = str_repeat( $t, $depth );
|
||||||
$output .= "{$n}{$indent}<ul class=\"sub-menu\">{$n}";
|
|
||||||
|
/**
|
||||||
|
* Filters the CSS class(es) applied to a menu list element.
|
||||||
|
*
|
||||||
|
* @since 4.8.0
|
||||||
|
*
|
||||||
|
* @param array $classes The CSS classes that are applied to the menu `<ul>` element.
|
||||||
|
* @param stdClass $args An object of `wp_nav_menu()` arguments.
|
||||||
|
* @param int $depth Depth of menu item. Used for padding.
|
||||||
|
*/
|
||||||
|
|
||||||
|
$classes = array( 'sub-menu' );
|
||||||
|
$classes = apply_filters( 'nav_menu_submenu_css_class', $classes, $args, $depth );
|
||||||
|
$class_names = join( ' ', $classes );
|
||||||
|
|
||||||
|
$output .= "{$n}{$indent}<ul class='" . esc_attr( $class_names ) . "'>{$n}";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.8-alpha-40536';
|
$wp_version = '4.8-alpha-40537';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user