WordPress.org

Ready to get started?Download WordPress

Forums

different menu for mobile theme (2 posts)

  1. BSK
    Member
    Posted 2 years ago #

    i'm working on a mobile version of a site and have 2 themes - a desktop version and a mobile version. i'm using the Device Theme Switcher plugin to load the mobile theme when the site is viewed on a mobile device. i'm also using the Theme Test Drive plugin to proof the mobile theme before it goes live.

    i created a second menu that i want to show only on the mobile theme, the first only showing on the desktop version.

    each theme has different code in functions.php and header.php to load the menu i want for each theme.

    everything is working great, but when i switch themes in the backend, the dropdown under Menus/Theme locations changes to blank and i have to keep re-selecting it every time. any idea what might be causing this?

    i have this code in my DESKTOP theme functions.php

    register_nav_menus(
    	array(
    	'menu'=>__('Menu'),
    	)
    );

    and DESKTOP theme header.php

    <?php
                //define main navigation
                wp_nav_menu( array(
                    'theme_location' => 'menu',
                    'sort_column' => 'menu_order',
                    'menu_class' => 'sf-menu',
                )); ?>

    i have this code in my MOBILE theme functions.php

    register_nav_menus(
    	array(
    	'mobile-menu'=>__('Mobile Menu'),
    	)
    );

    and MOBILE theme header.php

    <?php
                //define main navigation
                wp_nav_menu( array(
                    'theme_location' => 'mobile-menu',
                    'sort_column' => 'menu_order',
                    'menu_class' => 'sf-menu',
                )); ?>

    is there a better way to set a different menu for a mobile theme?

    thanks!

  2. plainplow
    Member
    Posted 2 years ago #

    See my post here.

Topic Closed

This topic has been closed to new replies.

About this Topic