Image
Image

Mobily – Mobile Theme Switcher

Description

Mobily serves a different theme to mobile visitors while desktop visitors keep your active theme. Pick a theme for each device class – or leave it at “Same as desktop”.

Features

  • Theme per device: iPhone & iPod touch, iPad, Android phones, Android tablets and all other mobile devices (Kindle, Opera Mini, BlackBerry, …).
  • Classic and block themes are supported. Every theme keeps its own menus, widgets, Customizer settings and global styles.
  • Visitor switch: visitors can change between the mobile and the desktop version. Their choice is remembered in a cookie (lifetime configurable).
  • Block “Theme Switch Link” for posts, pages and block theme templates, plus the classic shortcode [wp_mobily_shorter].
  • Preview each device theme as an administrator without affecting visitors.
  • Cache-safe: optional Vary: User-Agent, Cookie header; pages shown because of a visitor choice are never cached.
  • Safe by design: the admin area, REST API, AJAX, cron, the login page and the Customizer always use the desktop theme.
  • Abilities API: read-only ability wp-mobily/get-theme-for-user-agent tells AI assistants, MCP clients and scripts which theme a user agent gets (requires the switch_themes capability).
  • Modern code base for PHP 8.3+ – lightweight, no external requests, no tracking, no ads.

Switch links

  • ?mobily_wp_theme_layout=mobile – show the mobile theme
  • ?mobily_wp_theme_layout=desktop – show the desktop theme
  • ?mobily_wp_theme_layout=auto – forget the choice and detect the device again

The values mobily and orginal of older versions still work.

For developers

  • Filter mobily_detected_device – change the detected device (iphone, ipad, android, android_tablet, mobile or empty for desktop).
  • Filter mobily_target_theme – change the stylesheet served to the current visitor.
  • Ability wp-mobily/get-theme-for-user-agent – input user_agent (and optional layout: auto, mobile, desktop), output device, device_label, theme_slug, theme_name, is_mobile_theme:

    wp_get_ability( ‘wp-mobily/get-theme-for-user-agent’ )->execute( array( ‘user_agent’ => $ua ) );

Privacy

Mobily does not store personal data, does not contact external services and does not track visitors. If a visitor uses the switch link, a functional cookie (mobily_wp_theme_layout) remembers the choice. A suggested text for your privacy policy is added under Settings › Privacy.

Screenshots

ബ്ലോക്കുകൾ

ഈ പ്ലഗിൻ 1 ബ്ലോക്ക് നൽകുന്നു.

  • Theme Switch Link Mobily: lets visitors switch between the mobile and the desktop theme. Only shown where a switch is possible.

Installation

  1. Install the plugin through Plugins › Add New or upload the folder wp-mobily to /wp-content/plugins/.
  2. Activate the plugin.
  3. Install the theme(s) you want to use on mobile devices (they do not need to be activated).
  4. Go to Settings › Mobily and choose a theme for each device class.
  5. Optional: add the block “Theme Switch Link” or the shortcode [wp_mobily_shorter] so visitors can switch.

FAQ

Does it work with page caching?

Page-cache plugins store one copy of a page and serve it to everybody. Enable their mobile option (for example “separate cache for mobile devices” or “do not cache for mobile user agents”) so phones and desktops get different copies. For proxies and CDNs enable “Send the Vary header” in the Mobily settings (sends Vary: User-Agent, Cookie). Pages that are shown because of a visitor’s switch choice or an administrator preview are always sent with Cache-Control: private, no-store, Vary: Cookie and the DONOTCACHEPAGE constant, so they are never stored in shared caches.

My iPad shows the desktop theme. Why?

Since iPadOS 13, Safari requests the desktop website by default and identifies itself as a Mac. A server cannot tell it apart from a desktop computer. Visitors can still use the switch link.

Where do I configure menus and widgets for the mobile theme?

Use the preview link on the settings page to open the mobile theme. Menus, widgets and Customizer settings are stored per theme, so you can configure them while the mobile theme is active on a staging site, or with the Site Editor for block themes.

Does Mobily set cookies?

Only when a visitor uses the switch link. The functional cookie mobily_wp_theme_layout contains mobile or desktop and nothing else.

Which PHP and WordPress versions are required?

Mobily 5 requires PHP 8.3 or newer (tested with PHP 8.3, 8.4 and 8.5) and WordPress 7.0 or newer. If your site runs an older version, WordPress keeps offering you version 4.0 – ask your host for a PHP update first.

I updated from version 4.x or older. Do I have to configure everything again?

No. Your device themes, link texts and the “show on desktop” option are migrated automatically on the first page load after the update. Please check Settings › Mobily once.

Reviews

ഈ പ്ലഗിന് റിവ്യൂകൾ ഒന്നുമില്ല.

Contributors & Developers

“Mobily – Mobile Theme Switcher” is open source software. The following people have contributed to this plugin.

Contributors

Changelog

5.0.0

  • Renamed from WP-Mobily to Mobily – Mobile Theme Switcher (slug, shortcode, links and settings stay the same).
  • Complete rewrite for WordPress 7.0+ and PHP 8.3+ (tested with PHP 8.3, 8.4, 8.5 and WordPress 7.1): strict types, enums, readonly value objects, own autoloader.
  • New: Abilities API integration – read-only ability “Get theme for a user agent”.
  • New: “Other mobile devices” class, Android tablets and phones handled separately.
  • New: block “Theme Switch Link”, shortcode attributes mobile_text, desktop_text, class.
  • New: administrator preview per device, configurable cookie lifetime, optional Vary header, reset link (?mobily_wp_theme_layout=auto).
  • New: settings page with a modern card layout.
  • New: each mobile theme uses its own theme mods, menus and widgets.
  • Fixed: switch links of older versions did not work reliably (mobile vs. mobily), link texts could not be saved, PHP 8 warnings.
  • Fixed: the mobile theme was also loaded in the admin area, REST API and AJAX requests.
  • Security: all input is validated against whitelists, all output is escaped, the cookie is HttpOnly, SameSite=Lax and Secure on HTTPS.
  • Security: responses that depend on the visitor’s choice or a preview are marked as private/no-store and excluded from page caches (prevents cache poisoning).
  • Removed deprecated WordPress functions (get_themes, get_current_theme).

4.0

  • Tested with WordPress 5.6.

3.1

  • Tested with WordPress 4.9.4.

2.0

  • Fixed a query bug, tested with WordPress 4.4.

1.0

  • First release.