优化Switch案例PHP

I am currently creating a website in wordpress, and we have a 3 level navigation structure. The first two are always visible, but the third is dependent on the page you are currently visiting. Which means it has to switch.

For that, a switch statement would work, but considering we have a lot of different subpages, the amount of code will be quite big.

We have a template code, that will work for each menu (as it uses the same styling and placement), so all we really need is to switch out which template it's refering too.

We are currently determining the condition on is_page() like so:

if ( is_page() ) { // only do this for actual pages
         $page_obj = get_queried_object();

         switch ( $page_obj->post_name ) {

                case "products":
                    echo '<div class="third_menu_over">';
                    echo '<div class="container">';
                    wp_nav_menu( array(
                    'theme_location' => 'products',
                    'menu' => 'products_menu',
                    'depth' => 0,
                    'container' => false,
                    'menu_class' => 'third_menu',
                    'walker' => new wp_bootstrap_navwalker()
                    ));
                    echo '</div>';
                    echo '</div>';
                break;