Take your website
To the next level
Discover our newly launched customization services and elevate your web projects to new heights.
Delegate tasks, save time, and unlock the power of professional WordPress outsourcing.

Okay
  Public Ticket #2148938
Different menus
Closed

Comments

  • samiranich started the conversation

    Hi there,

    is there a way to use different menus for different pages?

    cheers,
    Sam*

  •  7,092
    Oliver replied

    Hi,

    here is the filter example for the child theme:

    function thegem_custom_wp_nav_menu_args($args) {
        if(in_array(get_the_ID(), array(11111))) {
            if($args['theme_location'] == 'primary') {
                $args['menu'] = 22222;
            }
        }
        return $args;
    }
    add_filter('wp_nav_menu_args', 'thegem_custom_wp_nav_menu_args');
    

    11111- page ID. 

    22222 - menu ID.

    Add this code to the functions.php of the child theme.

    Please note if you comment on your ticket before we reply, your ticket will be pushed down of the tickets list. 

    Regards, Oliver