Allow themes to specify a menu fllback other than wp_page_menu(). see #11817

git-svn-id: http://svn.automattic.com/wordpress/trunk@13415 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2010-02-25 22:00:26 +00:00
parent e3cba9ffe7
commit 2551152255
1 changed files with 2 additions and 2 deletions

View File

@ -8,7 +8,7 @@
* @param array $args Arguments
*/
function wp_nav_menu( $args = array() ) {
$defaults = array('id' => '', 'slug' => '', 'menu_class' => 'menu', 'format' => 'div');
$defaults = array('id' => '', 'slug' => '', 'menu_class' => 'menu', 'format' => 'div', 'fallback_cb' => 'wp_page_menu');
$args = wp_parse_args($args, $defaults);
$args = (object) $args;
@ -28,7 +28,7 @@ function wp_nav_menu( $args = array() ) {
}
if ( !$menu || is_wp_error($menu) )
return wp_page_menu( $args );
return call_user_func($args->fallback_cb, $args );
if ( 'div' == $args->format )
echo '<div class="' . esc_attr($args->menu_class) . '"><ul>';