Archived topic
Different menu for mobile
3 replies · Started by Anastasia on September 15, 2022
Greetings everyone,
I'd like to know if it's possible to create a different menu for mobile.
What I've done so far.
I've put inside my functions.php file these two scripts in order to enable the option for Mobile Menu in Wordpresse's Menu Tab
add_action( 'init', function() {
register_nav_menu( 'mobile-menu', __( 'Mobile Menu' ) );
} );
add_filter( 'generate_mobile_header_theme_location', function() {
return 'mobile-menu';
} );
I've created a new menu and named it "Mobile Menu" and checked the box for Mobile.
Unfortunately though it doesn't work since I can't see any changes on the frontend and also while inspecting my page classes, and menu ids are of primary's menu.
Hi there,
do you have the Mobile Header enabled in Customizer > Layout > Header?
Oh that it was?!
Thanks a lot David. Problem solved.
Glad to be of help :)