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 #1344779
Two Different Menus
Closed

Comments

  • bktime started the conversation

    I have a one page menu setup just fine.  However, I have a shop as well so that when someone clicks to view product details I need the shop page to have a simple menu so they can get back to the home page.  Since the one page menu will not work on that page how can I achieve this?

    So I need a one page menu for the homepage and then a secondary menu option for all other pages.

    Visual Bakery has a page option for this but it seems that it's missing from your theme.  Do you have other options that I haven't been able to discover yet.

    Thanks and really enjoying your theme a lot!

  •  7,092
    Oliver replied

    HI!

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

    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

    Add this code the 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