下载Bootstrap nav walker file.将此文件调用到函数。php。然后将此代码置于动态导航菜单:
<?php
$args = array(
\'theme_location\' => \'primary\',
\'menu\' => \'Main\',
\'container\' => \'false\',
\'container_class\' => \'\',
\'container_id\' => \'\',
\'menu_class\' => \'nav navbar-nav navbar-right\',
\'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\' => 5,
\'walker\' => new my_custom_walker_nav_menu()
);
wp_nav_menu ($args);
?>
您可以选择“深度”键的值需要多少深度