使用以下或任何其他自定义Walker\\u Nav\\u菜单似乎会导致导航菜单为空,我尝试指定默认值以确保我没有发疯,但它仍然会将输出为空。。。有什么想法吗?
<?php wp_nav_menu( array( \'theme_location\' => \'primary\', \'depth\' => 3, \'walker\' => new Walker_Nav_Menu() ) ); ?>
在上下文中<?php
/**
* The Header for our theme.
*
* Displays all of the <head> section and everything up till <div id="main">
*
* @package Expound
*/
?><!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( \'charset\' ); ?>" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title><?php wp_title( \'|\', true, \'right\' ); ?></title>
<link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="pingback" href="<?php bloginfo( \'pingback_url\' ); ?>" />
<!--[if lt IE 9]>
<script src="<?php echo get_template_directory_uri(); ?>/js/html5.js" type="text/javascript"></script>
<![endif]-->
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<div id="page" class="hfeed site">
<?php do_action( \'expound_header_before\' ); ?>
<header id="masthead" class="site-header" role="banner">
<div class="site-branding">
<div class="site-title-group">
<a href="<?php echo esc_url( home_url( \'/\' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( \'name\', \'display\' ) ); ?>" rel="home">
<!--div class="site-title"><!--?php bloginfo( \'name\' ); ?></div-->
<img height="240" width="722" alt="The All Australian Minecraft Community" class="wp-post-image" src="http://taamc.com/wordpress/wp-content/themes/expound-child/images/logo.png">
<!--h2 class="site-description"--><!--?php bloginfo( \'description\' ); ?--><!--/h2-->
<!--div id="sub-title">
<div id="sub-title-image"></div>
</div-->
</a>
</div>
</div>
<div class = "site-title-group">
<?php if ( dynamic_sidebar(\'header_widget_area\') ) : else : endif; ?>
</div>
<nav id="site-navigation" class="navigation-main" role="navigation">
<h1 class="menu-toggle"><?php _e( \'Menu\', \'expound\' ); ?></h1>
<div class="screen-reader-text skip-link"><a href="#content" title="<?php esc_attr_e( \'Skip to content\', \'expound\' ); ?>"><?php _e( \'Skip to content\', \'expound\' ); ?></a></div>
####################################################################################
<?php wp_nav_menu( array( \'theme_location\' => \'primary\', \'depth\' => 3, \'walker\' => new Walker_Nav_Menu()) ); ?>
####################################################################################
<div class="site-nav-search"><?php if ( dynamic_sidebar(\'navigation_widget_area\') ) : else : endif; ?></div>
<?php do_action( \'expound_navigation_after\' ); ?>
</nav><!-- #site-navigation -->
</header><!-- #masthead -->
<?php do_action( \'expound_header_after\' ); ?>
<div id="main" class="site-main">
以上内容当前位于我的标题中。php的子主题,如果这有什么不同,原始主题也使用默认的walker,但没有明确说明。使用如上所述的php
<div class="menu">
<ul class=" nav-menu">
<li class="current_page_item">
<a href="http://taamc.com/">Home</a>
</li>
<li id="menu-item-21" class="menu-item-21">
<a></a>
</li>
<li id="menu-item-87" class="menu-item-87">
<a></a>
</li>
<li id="menu-item-122" class="menu-item-122">
<a></a>
</li>
<li id="menu-item-28" class="menu-item-28">
<a></a>
</li>
<li id="menu-item-127" class="menu-item-127">
<a></a>
</li>
<li id="menu-item-22" class="menu-item-22">
<a></a>
</li>
</ul>
</div>
给出错误:Notice: Trying to get property of non-object in /home/taamc/public_html/wordpress/wp-includes/nav-menu-template.php on line 148
Notice: Trying to get property of non-object in /home/taamc/public_html/wordpress/wp-includes/nav-menu-template.php on line 151
Notice: Trying to get property of non-object in /home/taamc/public_html/wordpress/wp-includes/nav-menu-template.php on line 151
Notice: Trying to get property of non-object in /home/taamc/public_html/wordpress/wp-includes/nav-menu-template.php on line 153
Notice: Trying to get property of non-object in /home/taamc/public_html/wordpress/wp-includes/nav-menu-template.php on line 148
Notice: Trying to get property of non-object in /home/taamc/public_html/wordpress/wp-includes/nav-menu-template.php on line 151
Notice: Trying to get property of non-object in /home/taamc/public_html/wordpress/wp-includes/nav-menu-template.php on line 151
Notice: Trying to get property of non-object in /home/taamc/public_html/wordpress/wp-includes/nav-menu-template.php on line 153
Notice: Trying to get property of non-object in /home/taamc/public_html/wordpress/wp-includes/nav-menu-template.php on line 148
Notice: Trying to get property of non-object in /home/taamc/public_html/wordpress/wp-includes/nav-menu-template.php on line 151
Notice: Trying to get property of non-object in /home/taamc/public_html/wordpress/wp-includes/nav-menu-template.php on line 151
Notice: Trying to get property of non-object in /home/taamc/public_html/wordpress/wp-includes/nav-menu-template.php on line 153
Notice: Trying to get property of non-object in /home/taamc/public_html/wordpress/wp-includes/nav-menu-template.php on line 148
Notice: Trying to get property of non-object in /home/taamc/public_html/wordpress/wp-includes/nav-menu-template.php on line 151
Notice: Trying to get property of non-object in /home/taamc/public_html/wordpress/wp-includes/nav-menu-template.php on line 151
Notice: Trying to get property of non-object in /home/taamc/public_html/wordpress/wp-includes/nav-menu-template.php on line 153
Notice: Trying to get property of non-object in /home/taamc/public_html/wordpress/wp-includes/nav-menu-template.php on line 148
Notice: Trying to get property of non-object in /home/taamc/public_html/wordpress/wp-includes/nav-menu-template.php on line 151
Notice: Trying to get property of non-object in /home/taamc/public_html/wordpress/wp-includes/nav-menu-template.php on line 151
Notice: Trying to get property of non-object in /home/taamc/public_html/wordpress/wp-includes/nav-menu-template.php on line 153
Notice: Trying to get property of non-object in /home/taamc/public_html/wordpress/wp-includes/nav-menu-template.php on line 148
Notice: Trying to get property of non-object in /home/taamc/public_html/wordpress/wp-includes/nav-menu-template.php on line 151
Notice: Trying to get property of non-object in /home/taamc/public_html/wordpress/wp-includes/nav-menu-template.php on line 151
Notice: Trying to get property of non-object in /home/taamc/public_html/wordpress/wp-includes/nav-menu-template.php on line 153
使用主题中默认的php<?php wp_nav_menu( array( \'theme_location\' => \'primary\', \'depth\' => 3) ); ?>
<div class="menu">
<ul class=" nav-menu">
<li class="current_page_item">
<a href="http://taamc.com/">Home</a>
</li>
<li class="page_item page-item-21">
<a href="http://taamc.com/activity/">Activity</a>
</li>
<li class="page_item page-item-87">
<a href="http://taamc.com/gallery/">Gallery</a>
</li>
<li class="page_item page-item-122">
<a href="http://taamc.com/getting-started/">Getting Started</a>
</li>
<li class="page_item page-item-28">
<a href="http://taamc.com/groups/">Groups</a>
</li>
<li class="page_item page-item-127">
<a href="http://taamc.com/map/">Map</a>
</li>
<li class="page_item page-item-22">
<a href="http://taamc.com/members/">Members</a>
</li>
</ul>
</div>