Remove vestigial 'context' code for wp_nav_menu. This was used when we used to use the same function as a theme template tag and admin template function (now we don't.) fixes #13656.
git-svn-id: https://develop.svn.wordpress.org/trunk@15075 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
ef2a9bacc1
commit
b19e242aa5
|
@ -833,7 +833,6 @@ case 'add-menu-item' :
|
||||||
$args = array(
|
$args = array(
|
||||||
'after' => '',
|
'after' => '',
|
||||||
'before' => '',
|
'before' => '',
|
||||||
'context' => 'backend',
|
|
||||||
'link_after' => '',
|
'link_after' => '',
|
||||||
'link_before' => '',
|
'link_before' => '',
|
||||||
'walker' => new Walker_Nav_Menu_Edit,
|
'walker' => new Walker_Nav_Menu_Edit,
|
||||||
|
|
|
@ -198,7 +198,6 @@ class Walker_Nav_Menu_Checklist extends Walker_Nav_Menu {
|
||||||
* echo - Whether to echo the menu or return it. Defaults to echo.
|
* echo - Whether to echo the menu or return it. Defaults to echo.
|
||||||
* depth - how many levels of the hierarchy are to be included. 0 means all. Defaults to 0.
|
* depth - how many levels of the hierarchy are to be included. 0 means all. Defaults to 0.
|
||||||
* walker - allows a custom walker to be specified.
|
* walker - allows a custom walker to be specified.
|
||||||
* context - the context the menu is used in.
|
|
||||||
* theme_location - the location in the theme to be used. Must be registered with register_nav_menu() in order to be selectable by the user.
|
* theme_location - the location in the theme to be used. Must be registered with register_nav_menu() in order to be selectable by the user.
|
||||||
*
|
*
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
|
@ -209,7 +208,7 @@ function wp_nav_menu( $args = array() ) {
|
||||||
global $_wp_nav_menu_slugs;
|
global $_wp_nav_menu_slugs;
|
||||||
$defaults = array( 'menu' => '', 'container' => 'div', 'container_class' => '', 'container_id' => '', 'menu_class' => 'menu',
|
$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' => '',
|
'echo' => true, 'fallback_cb' => 'wp_page_menu', 'before' => '', 'after' => '', 'link_before' => '', 'link_after' => '',
|
||||||
'depth' => 0, 'walker' => '', 'context' => 'frontend', 'theme_location' => '' );
|
'depth' => 0, 'walker' => '', 'theme_location' => '' );
|
||||||
|
|
||||||
$args = wp_parse_args( $args, $defaults );
|
$args = wp_parse_args( $args, $defaults );
|
||||||
$args = apply_filters( 'wp_nav_menu_args', $args );
|
$args = apply_filters( 'wp_nav_menu_args', $args );
|
||||||
|
@ -237,12 +236,10 @@ function wp_nav_menu( $args = array() ) {
|
||||||
if ( $menu && ! is_wp_error($menu) && !isset($menu_items) )
|
if ( $menu && ! is_wp_error($menu) && !isset($menu_items) )
|
||||||
$menu_items = wp_get_nav_menu_items( $menu->term_id );
|
$menu_items = wp_get_nav_menu_items( $menu->term_id );
|
||||||
|
|
||||||
// If no menu was found or if the menu has no items, call the fallback_cb
|
// If no menu was found or if the menu has no items, call the fallback_cb if it exists
|
||||||
if ( !$menu || is_wp_error($menu) || ( isset($menu_items) && empty($menu_items) ) ) {
|
if ( ( !$menu || is_wp_error($menu) || ( isset($menu_items) && empty($menu_items) ) )
|
||||||
if ( 'frontend' == $args->context && ( function_exists($args->fallback_cb) || is_callable( $args->fallback_cb ) ) ) {
|
&& ( function_exists($args->fallback_cb) || is_callable( $args->fallback_cb ) ) )
|
||||||
return call_user_func( $args->fallback_cb, (array) $args );
|
return call_user_func( $args->fallback_cb, (array) $args );
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If no fallback function was specified and the menu doesn't exists, bail.
|
// If no fallback function was specified and the menu doesn't exists, bail.
|
||||||
if ( !$menu || is_wp_error($menu) )
|
if ( !$menu || is_wp_error($menu) )
|
||||||
|
@ -258,7 +255,6 @@ function wp_nav_menu( $args = array() ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set up the $menu_item variables
|
// Set up the $menu_item variables
|
||||||
if ( 'frontend' == $args->context )
|
|
||||||
_wp_menu_item_classes_by_context( $menu_items );
|
_wp_menu_item_classes_by_context( $menu_items );
|
||||||
|
|
||||||
$sorted_menu_items = array();
|
$sorted_menu_items = array();
|
||||||
|
@ -309,7 +305,7 @@ function wp_nav_menu( $args = array() ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the class property classes for the current frontend context, if applicable.
|
* Add the class property classes for the current context, if applicable.
|
||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
|
|
Loading…
Reference in New Issue