Allow a theme to set an id on the container object for the wp_nav_menu output. Fixes #13057 props thee17.
git-svn-id: https://develop.svn.wordpress.org/trunk@14182 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
3750f4ac5d
commit
dcdde9cb36
@ -17,6 +17,9 @@
|
|||||||
* menu_class - CSS class to use for the div container of the menu list. Defaults to 'menu'.
|
* menu_class - CSS class to use for the div container of the menu list. Defaults to 'menu'.
|
||||||
* format - Whether to format the ul. Defaults to 'div'.
|
* format - Whether to format the ul. Defaults to 'div'.
|
||||||
* fallback_cb - If the menu doesn't exists, a callback function will fire. Defaults to 'wp_page_menu'.
|
* fallback_cb - If the menu doesn't exists, a callback function will fire. Defaults to 'wp_page_menu'.
|
||||||
|
* container - Type of container tag. Avalible options div, p, or nav. Defaults to 'div'.
|
||||||
|
* container_class - Chooses a class for the container.
|
||||||
|
* container_id - Chooses an id for the container.
|
||||||
* before - Text before the link text.
|
* before - Text before the link text.
|
||||||
* after - Text after the link text.
|
* after - Text after the link text.
|
||||||
* link_before - Text before the link.
|
* link_before - Text before the link.
|
||||||
@ -30,7 +33,7 @@
|
|||||||
* @param array $args Arguments
|
* @param array $args Arguments
|
||||||
*/
|
*/
|
||||||
function wp_nav_menu( $args = array() ) {
|
function wp_nav_menu( $args = array() ) {
|
||||||
$defaults = array( 'menu' => '', 'container' => 'div', 'container_class' => '', 'menu_class' => 'menu', 'echo' => true,
|
$defaults = array( 'menu' => '', 'container' => 'div', 'container_class' => '', 'container_id' => '', 'menu_class' => 'menu', 'echo' => true,
|
||||||
'fallback_cb' => 'wp_page_menu', 'before' => '', 'after' => '', 'link_before' => '', 'link_after' => '',
|
'fallback_cb' => 'wp_page_menu', 'before' => '', 'after' => '', 'link_before' => '', 'link_after' => '',
|
||||||
'depth' => 0, 'walker' => '', 'context' => 'frontend' );
|
'depth' => 0, 'walker' => '', 'context' => 'frontend' );
|
||||||
|
|
||||||
@ -70,7 +73,8 @@ function wp_nav_menu( $args = array() ) {
|
|||||||
|
|
||||||
if ( in_array( $args->container, $container_allowedtags ) ) {
|
if ( in_array( $args->container, $container_allowedtags ) ) {
|
||||||
$class = $args->container_class ? ' class="' . esc_attr($args->container_class) . '"' : ' class="menu-'. $menu->slug .'-container"';
|
$class = $args->container_class ? ' class="' . esc_attr($args->container_class) . '"' : ' class="menu-'. $menu->slug .'-container"';
|
||||||
$nav_menu .= '<'. $args->container . $class .'>';
|
$container_id = $args->container_id ? ' id="' . esc_attr($args->container_id) . '"' : '' ;
|
||||||
|
$nav_menu .= '<'. $args->container . $class . $container_id .'>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set up the $menu_item variables
|
// Set up the $menu_item variables
|
||||||
|
Loading…
Reference in New Issue
Block a user