-
AuthorPosts
-
August 3, 2017 at 10:11 am #833799
Hi there
Since the last update our mobile menu shows all the items from our desktop AND mobile website. I did everything written in here: http://kriesi.at/documentation/enfold/hide-menu-itemselements-on-mobile/
Can you help me?
Thanks and regards,
SimonAugust 5, 2017 at 2:09 pm #834780Hey Simon,
Currently custom CSS classes are stripped out of menu items on mobile. We will fix it in upcoming Enfold update. In the meantime, you can try creating a new menu for mobile version and add following code to Functions.php file in Appearance > Editor and display different menu on mobile
function av_different_mobile_menu( $args = '' ) { if($args['menu_id'] == 'avia-menu') { if(wp_is_mobile()) { $args['menu'] = 'main-menu-mobile'; } else { $args['menu'] = 'main-menu'; } } return $args; } add_filter( 'wp_nav_menu_args', 'av_different_mobile_menu' );
Please make sure to replace menu names (“main-menu” and “main-menu-mobile”) in the code to match the name of your menus
Best regards,
YigitAugust 10, 2017 at 4:24 pm #837047It worked, thanks!
Regards,
SimonAugust 11, 2017 at 12:42 pm #837418Hi Simon,
Glad it worked for you! :)
We will keep the thread open and will wait to hear from the creator of this thread. If you have any other questions or issues, please feel free to start a new thread.
Best regards,
VictoriaAugust 15, 2017 at 10:10 am #839148Hi Victoria
I just realized, it doesn’t work anymore. I did the following steps:
1. Appearance > Menu: I created two seperated menus, linked them to the desktop and the mobile sections and named them (main-menu & main-menu-mobile)
2. Appearance > Editor: I added the following code:
`function av_different_mobile_menu( $args = ” ) {
if($args[‘menu_id’] == ‘avia-menu’) {
if(wp_is_mobile()) {
$args[‘menu’] = ‘main-menu-mobile’;
} else {
$args[‘menu’] = ‘main-menu’;
}
}
return $args;
}
add_filter( ‘wp_nav_menu_args’, ‘av_different_mobile_menu’ );Did I miss something?
Thanks for your help!
SimonAugust 15, 2017 at 11:21 am #839194Hi Simon,
Can you give us temporary admin access to your website in the private content box below, so that we can have a closer look?
Best regards,
VictoriaAugust 15, 2017 at 11:39 am #839205This reply has been marked as private.August 18, 2017 at 7:00 am #840759 -
AuthorPosts
- You must be logged in to reply to this topic.