Hello Summer Sale!
Exclusive season-opening discount on TheGem theme.
Limited time offer.

Okay
  Public Ticket #1519654
Multiple menus
Closed

Comments

  • luke started the conversation

    Good day is it possible to have pages with different menus, I have created my website with a one page parallax menu but when you click on a blog, a new page comes up which needs its on parallax menu? I need to assign different menus to certain pages.

  •  7,280
    Oliver replied

    Hi,

    Here is the code example for settings up different menu on the different pages via the filter:

    function thegem_custom_wp_nav_menu_args($args) {
        if(in_array(get_the_ID(), array(555))) {        
        if($args['theme_location'] == 'top_area') {            
            $args['menu'] = 1000;        
        }    
    }        
    if(in_array(get_the_ID(), array(666))) {    
        if($args['theme_location'] == 'primary') {            
            $args['menu'] = 1001;        
        }    
      }    return $args;
    }
    add_filter('wp_nav_menu_args', 'thegem_custom_wp_nav_menu_args');

    555 and 666 page ID

    1000 and 1001 - menu ID


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

    Regards, Oliver

  •   luke replied privately
  •  7,280

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

    Regards, Oliver