[Plugin: Device Theme Switcher] Navigation in mobile theme
I’m having a bit of trouble assigning a menu to the mobile and tablet themes.
I activate the theme I want for mobile and tablets, then assign some custom menus to it. This works fine, the menus display perfectly on mobile devices, but when I switch back to the desktop theme, the mobile theme loses its menu settings and just displaying all posts in the menu.
Is there something I’m missing?
Any help would be appreciated.
This is quite similar to this widget question, http://wordpress.org/support/topic/plugin-device-theme-switcher-widget-locations?replies=3 Where menus and sidebars are per theme, an inherit feature of WordPress. If you want to have a widget or menu for just one of the themes you need to create the menu or widget in both themes. When the handheld theme is delivered to the user WordPress still thinks the desktop theme is active (we merely tap into the request and switch which theme is delivered to the user). So your menu or widget needs to also be registered / populated in the desktop theme, even if you’re not displaying it anywhere in the desktop theme.
Let me know if you have more questions about this!
Thank you for the quick response.
Looking at the themes menu options, both themes have the menu available to use. They seem to already share all available menus. So I can’t create a duplicate menu with the same name as it already exists.
If the menu is outputting all pages, not the ones you set in Appearance > Menus, then the menu does not exist in the theme. I.e. in your functions.php IN BOTH THEMES you need to have the same register_nav_menus() to register the locations… and in Appearance > Menus you need to have created the same menus. Try activating your desktop theme, create the menu. Then activate the mobile theme, and create the same menu. Populate both with the same pages. This way the menu exists in both themes.
i need desperately support.
i´ve got two themes (there both the same, but two times installed).
one for desktop, one for mobile devices.
if i activate the mobile-version the menue is the same as in the desktop-version. if i activate the mobile-theme and the mobile-menue it works logically – but if i activate the desktop-theme again (what i have to do) then the mobile-menue is inactive on the iPhone again.
what am i doing wrong?
Please read the thread above, as this pertains to your issue. Basically, you need to have two different menus, both menus need to be registered in both themes, and you display one menu in one theme and the other menu in the other theme. When a visitor is given the handheld theme, WordPress still thinks the desktop theme is active, so as long as your mobile menu is registered/populated in the desktop theme you’ll be able to use two different menus, one in each theme.
Hope that helps.
I’ve done the above but Main Menu is still pulling up for desktop and mobile devices.
I added the following code to both themes (it’s the same theme copied, folder renamed and styles.css updated:
register_nav_menu(‘main’, ‘Main navigation menu’);
register_nav_menu(‘Mobile’, ‘Mobile navigation menu’);
Please note I didn’t need to recreate menus for copied theme both menus were already available.
Menus are saved with themes. As I go back and forth betwn. themes Desktop theme shows Main Menu and Mobile Theme shows Mobile menu.
My URL is goensouthweddings.com
Ok, good. Did you also populate both menus while the ‘default’/desktop theme is active?
I’m not sure what you mean by Did you also populate both menus while the ‘default’/desktop theme is active?
The menus (Main Menu and Mobile) were both built prior to DTS plugin was installed. I simply selected appropriate menu in the drops under Appearance > Menus for each theme.
I guess I’m not sure what you mean by populate.
As in, that you added pages to both menus in while the desktop theme is active. Note, you ONLY activate the handheld theme for debugging. You must create/populate both menus while the desktop theme is activated.
James, I am having the same issue as above. I placed this code in both themes’ functions.php:
‘header_menu’ => __( ‘Header Menu’, ‘main navigation menu’ )
I am not sure how to populate both menus while the default theme is active. Can you give me some advice?
When I load the mobile site, the actual menu links aren’t there, but the styling for them is all as it should be.
- The topic ‘[Plugin: Device Theme Switcher] Navigation in mobile theme’ is closed to new replies.