• Resolved redkite

    (@redkite)


    Hi James,

    I posted this in a thread that was resolved, so I’ll try again.

    So for my mobile theme, there will only be a couple of widgets in the footer sidebar. The default theme has a large number of widgets, but none of them overlap between the two themes (no widget appears in both themes).

    How do I deal with that – can I just hide the relevant default-theme sidebars in the mobile theme with a simple function in functions.php? Do I need to create a new sidebar for the footer that will only display in the mobile theme?

    I just don’t want all my default theme widgets to disappear into the inactive box when a user switches themes…

    https://www.ads-software.com/extend/plugins/device-theme-switcher/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author James Mehorter

    (@jamesmehorter)

    Hi redkite – This question was answered in the previous thread.

    https://www.ads-software.com/support/topic/plugin-device-theme-switcher-widget-locations?replies=7

    Basically, you need to create both theme sidebars in both themes, i.e. register_sidebar(‘desktop’) and register_sidebar(‘mobile’) should be in both themes for all sidebars. With your default/desktop theme active, populate both sidebars with your widgets as you want them. And you simply only show the ‘desktop’ sidebar in the desktop theme and vice versa. So in your mobile theme you have dynamic_sidebar(‘mobile’) instead of (‘desktop’). You don’t set the mobile theme as active and populate the sidebars like that. You do it all in the active/desktop theme.

    WordPress only stores the active theme sidebars/widgets. When a mobile user visits the site, the ‘active’ theme is not changed, but the mobile theme is delivered to the user. So those mobile theme files are essentially using all the settings from the active/desktop theme. Think of it as a switcheroo ?? Sleight of hand.

    It’s a little tricky to think about how it works, and is certainly not optimal. It would be real nice if you could just set the mobile theme as active, populate the nav menus and widgets and set the desktop theme back to active. But as you’ve noticed, WP doesn’t keep every theme’s settings like that.

    Hope that helps!

    Thread Starter redkite

    (@redkite)

    Thanks, I just wasn’t totally clear on the explanation. This helps.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Separate widget for mobile theme?’ is closed to new replies.