Download Bootstrap nav walker file.Call this file to your functions.php. Then Put this code to dynamic your nav menu:
<?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);
?>
You can choose the value to the ‘depth’ key how many depth you need