Mobile theme switcher – issues with menu

Home Forums Any Mobile Theme Switcher Mobile theme switcher – issues with menu

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #2922
    Inhale
    Guest

    Hi, so first off, thanks for the plug in – it’s super useful and is hopefully going to save me a lot of trouble. The problem I’m having right now is, that after setting all my customizations for the mobile (which you can only do when it’s the primary theme) the menu I’ve picked for the mobile theme reverts back to a “default” menu which is just my page listings and not actually a menu.

    I really, really need to have it *not* do this. Do you know what I should look for in the php to manually set a specific menu?

    Thanks so much !

    #2924
    Dinesh
    Keymaster

    Hi Inhale,

    In this case, you need to create a different menu and assign it directly to your mobile theme.

    Thanks

    #3940
    grlfsk
    Guest

    Hello,

    I’m reviving this thread, because I have the same problem.

    I actually assigned a specific mobile menu to my mobile theme through the theme settings. This is only possible when the mobile theme is set as default theme, otherwise the menu settings page for the mobile theme cannot be seen.

    But when switching the default theme back to the desktop theme the setting is then not applied if the theme is switched by mobile switcher.

    What exactly do you mean with assigning it _directly_ to the the theme? Is there some way to do that in the code? Or did you mean the way I described above (which apparently doesn’t work?)

    Thank you!

    #3941
    grlfsk
    Guest

    Ok I just found the solution!:

    I added the following code to my main themes functions.php:

    function register_my_menu() {
      register_nav_menu('header-menu',__( 'Header Menu' ));
    }
    add_action( 'init', 'register_my_menu' );

    This works because my mobile theme uses this header-menu and my main theme doesn’t. Now I can set the mobile menu in my main theme, because d/t this code it is added there to the menu positions settings and passed on to the mobile theme during switching. Hope it’s clear and it helps somebody else.

    Just an idea for the plugin – would it be possible to automatically add all menu definitions from selected mobile themes to the default theme menu positions page? Or any other routine which registers the mobile menus with the default theme?

    #3948
    Dinesh
    Keymaster

    Hi,

    Thank you so much for sharing the code here. However, the suggestion you have mentioned can’t be done with this plugin. We did try for menu and widgets last time, but failed.

    So the solution you have posted above is only the way right now.

    Thanks

    #3994
    Johannes
    Guest

    Hell Dinesh, i am running into the same difficulties with the menu for the mobile site. I have created a different menu for the mobile theme. But on mobile devices, the site only shows ALL of my wordpress pages. The menu i have chosen for the mobile theme is not shown.

    If i choose an existing menue which is uses in the desktop version – the same thing happens – it only shows ALL wordpress pages.

    How can i assign a separate menu for the mobile theme?
    Do i need some hardcoding?

    #3996
    Dinesh
    Keymaster

    Hi Johannes,

    For this issue, please create a new menu and name it like mobile_menu. Then replace the menu code manually in your mobile theme header file. Like this way ‘mobile_menu’)); ?>

    Hope this helps.

    Thanks

    #4920
    Maria
    Guest

    Hi, I found here a solution for this and it works:

    In your mobile template, when you add a menu, you must add parameter ‘menu’=> ’10’, where the number is the id of your menu. For example:

    
    <?php wp_nav_menu( 
    array( 
    	'theme_location' => 'mobile_menu',
    	'menu' => '17' // This is the menu id number. You can see it when you edit a menu in wordpress admin.
    
       ) 
    ); ?>
Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Mobile theme switcher – issues with menu’ is closed to new replies.