我在使用wp\\U nav\\U菜单生成子菜单时遇到问题。如何更改由wp\\U nav\\U菜单为ClassA引导程序生成的ClassA子菜单?
查看我的问题:
这是我生成菜单的代码:
<nav class="row menu">
<?php wp_nav_menu( array(
\'theme_location\' => \'category-menu\',
\'container\' => \'\',
\'container_class\' => \'\',
\'container_id\' => \'main-navbar-collapse\',
\'menu_class\' => \'nav nav-pills\',
\'menu_id\' => \'\',
\'echo\' => true,
\'fallback_cb\' => \'wp_page_menu\',
\'before\' => \'\',
\'after\' => \'\',
\'link_before\' => \'\',
\'link_after\' => \'\',
\'items_wrap\' => \'<ul id="%1$s" class="%2$s">%3$s</ul>\',
\'depth\' => 0,
\'walker\' => \'\'
)); ?>
</nav>
如何为ClassA下拉引导修改它?
SO网友:Vino
您需要编写一个自定义菜单漫游器。
看见this code 对于步行者。(或搜索“Bootstrap Menu Walker”。)
然后使用:
wp_nav_menu( array(
\'menu\' => \'header\',
\'menu_class\' => \'nav nav-pills\',
\'container\' => \'nav\',
\'container_class\' => $classes,
\'fallback_cb\' => false,
\'depth\' => 2,
\'walker\' => new Bootstrap_Walker_Menu_Nav(),
\'theme_location\' => \'header\',
\'echo\' => false,
));