我遇到了一些问题,无法使用wp\\u nav\\u menu()将类指定给标记,而不是将类指定给它创建的标记,并将类指定给该标记。
My register\\u nav\\u菜单功能:
function register_primary_menu() {
register_nav_menu(\'primary-menu\', __(\'Primary Menu\'));
}
add_action(\'init\', \'register_primary_menu\');
wp\\U nav\\U菜单:
<?php
$defaults = array(
\'theme_location\' => \'primary-menu\',
\'menu\' => \'\',
\'container\' => \'flase\',
\'container_class\' => \'\',
\'container_id\' => \'\',
\'menu_class\' => \'nav navbar-nav\',
\'menu_id\' => \'\',
\'echo\' => true,
\'fallback_cb\' => \'wp_page_menu\',
\'before\' => \'<li>\',
\'after\' => \'</li>\',
\'link_before\' => \'\',
\'link_after\' => \'\',
\'items_wrap\' => \'<ul id="%1$s" class="%2$s">%3$s</ul>\',
\'depth\' => 0,
\'walker\' => \'\'
);
wp_nav_menu( $defaults );
?>
我想要的是:
<ul class="nav navbar-nav">
<li><a href="#">Home</a></li>
<li><a href="#">Page 1</a></li>
<li><a href="#">Page 2</a></li>
<li><a href="#">Page 3</a></li>
</ul>
我得到的是:
<div class="nav navbar-nav">
<ul>
<li class="page_item page-item-56"><a href="[URL]">Page 1</a></li>
<li class="page_item page-item-58"><a href="[URL]">Page 2</a></li>
<li class="page_item page-item-60"><a href="[URL]">Page 3</a></li>
<li class="page_item page-item-2"><a href="[URL]">Sample Page</a></li>
</ul>
</div>