[Resolved] Different mobile menu?

Home Forums Support [Resolved] Different mobile menu?

Home Forums Support Different mobile menu?

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #183825
    leo

    Is it possible to use a different menu for mobile?

    #183855
    Tom
    Lead Developer
    Lead Developer

    It depends.

    If you’re using the Slideout menu, you can set it as a theme location in “Appearance > Menus”.

    If you’re using the Mobile Header, there’s a simple filter I can provide.

    If you’re using the default mobile menu, I’m afraid it uses the same menu as desktop.

    Let me know ๐Ÿ™‚

    #183868
    leo

    I know. I used the Slideout menu first, but the dropdown for submenus only works when you click on the arrow precisely (on mobile). So I switched back to the default menu, where you can hit the bar anywhere to get the dropdown.

    It’s not a very big deal, but if it’s not too much trouble, I would be interested in your filter.

    Thanks Tom!

    Edit for Tom: the menu you see on the homepage is the menu for visitors. Logged in users have many more options.

    • This reply was modified 8 years ago by leo.
    • This reply was modified 8 years ago by leo.
    #183877
    Tom
    Lead Developer
    Lead Developer

    The mobile menu should act the same regardless of slideout vs regular. If your menu item has # as the URL, you should be able to tap the entire item to initiate the dropdown. This is a feature in the latest version.

    To create a new theme location for the mobile header, you need to do something like this:

    add_action( 'init', 'generate_register_mobile_menu' );
    function generate_register_mobile_menu() {
      register_nav_menu( 'mobile-menu',__( 'Mobile Menu' ) );
    }

    Then you need to add this:

    add_filter( 'generate_mobile_header_theme_location', 'generate_change_mobile_header_menu' );
    function generate_change_mobile_header_menu()
    {
        return 'mobile-menu';
    }

    Adding PHP: https://generatepress.com/knowledgebase/adding-php-functions/

    • This reply was modified 8 years ago by Tom.
    #183881
    leo

    Wow man, this is Support 3.0. The # did the trick.

    Thanks a million!

    #183882
    Tom
    Lead Developer
    Lead Developer

    You’re welcome ๐Ÿ™‚

    #418680
    Samuel

    I’d like to ask a related question here, even though the thread is more than a year old.

    I created a new menu (“TestMenu”) that is not assigned to any of the three locations (Primary, Secondary, or Slideout). I would like to use “TestMenu” as my mobile menu instead of the default, which is the Primary menu.

    I added the two code snippets provided above, and I now have “Mobile Menu” under Appearance->Menus->Manage Locations, and I can select my “TestMenu” as an option.

    But I don’t know what to do next. The Primary menu still shows up in the mobile context. Are there additional steps, or is what I’m trying to do not possible?

    Thank you —

    #418715
    Leo
    Staff
    Customer Support

    Hi there,

    Best way is to assign the new menu to be slideout menu, then activate it for mobile only:
    https://docs.generatepress.com/article/activating-slide-out-navigation/

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.