WordPress.org

Ready to get started?Download WordPress

Plugin Directory

Device Theme Switcher

Set a separate theme for handheld and tablet devices under Appearance > Device Themes

How to Install

Install and activate in your WordPress Dashboard 'Plugins > Add New' section by searching for 'Device Theme Switcher'.

After activation you'll have a new menu: 'Appearance > Device Themes'--where you set which theme is given to which visitor device.

URL Switching - NEW in Version 2.0!

Your device themes can be easily accessed to 'test' and see what other devices see.

http://www.mywebsite.com/?theme=handheld
http://www.mywebsite.com/?theme=tablet
http://www.mywebsite.com/?theme=low_support
http://www.mywebsite.com/?theme=active

Template Tags, Shortcodes, and Widgets - NEW in Version 2.0!

Template Tags, Shortcodes, and Widgets all output a simple HTML anchor tag which links to the mobile/active theme for the website by using URL Switching (See Above).

Template tags can be used in any theme or plugin file. Shortcodes can be used in the content of any post, page, or custom-post-type.

//Template Tag - Display a link to 'View Full Website'
<?php link_to_full_website($link_text = "View Full Website", $css_classes = array('blue-text', 'alignleft'), $echo = true) ?>

//Shortcode - Display a link to 'View Full Website'
[link_to_full_website link_text="View Full Website" css_classes="blue-text, alignleft"]
//Template Tag - Display a link to 'Return to Mobile Website'
<?php link_back_to_device($link_text = "Return to Mobile Website", $css_classes = array('red-text', 'alignright'), $echo = true) ?>

//Shortcode -  - Display a link to 'Return to Mobile Website'
[link_back_to_device link_text="Return to Mobile Website" css_classes="red-text, alignright"]

The anchor tags that output have a CSS class of 'dts-link'. The 'View Full Website' anchor tag also has a class of 'to-full-website' and the 'Return to the Mobile Website' link has an additional class of 'back-to-mobile'. This CSS can be used anywhere in your theme or style.css file.

Link Styling Example (For Tempalte Tags, Widgets, or Shortcodes):

<style type="text/css">
    .dts-link {
        font-size: 1.5em ;
    }
        .dts-link.to-full-website {
            color: red ;
        }
        .dts-link.back-to-mobile {
            color: blue ;
        }
</style>

$dts global - NEW in Version 2.0!

The $dts global contains all the run-time device theme switcher settings and the current visitor device. You can access the $dts global anywhere in your theme or plugin.

<?php 
    //Access the device theme switcher object anywhere in your theme or plugin
    global $dts
    
    //use it..
    if ($dts->device == 'tablet') do_something() ;

    //See what's in there..
    print_r($dts) ;

    DTS_Switcher Object
    (
        [handheld_theme] => Array
            (
                [name] => Responsive
                [template] => responsive
                [stylesheet] => responsive
            )
        [tablet_theme] => Array
            (
                [name] => Twenty Twelve
                [template] => twentytwelve
                [stylesheet] => twentytwelve
            )
        [low_support_theme] => Array
            (
                [name] => WordPress Default
                [template] => default
                [stylesheet] => default
            )
        [active_theme] => Array
            (
                [name] => Responsive
                [template] => responsive
                [stylesheet] => responsive
            )
        [device] => active (Possible values: active, handheld, tablet, and low_support)
        [theme_override] => tablet (Possible Values: See Above)(Explanation: I'm on a computer, so my device is 'active' [I get the active theme] and I used a URL parameter [site.com?theme=tablet] to view the tablet theme)
    )
?>

Requires: 3.0 or higher
Compatible up to: 3.9.1
Last Updated: 2014-5-18
Downloads: 27,565

Ratings

5 stars
5 out of 5 stars

Support

6 of 7 support threads in the last two months have been resolved.

Got something to say? Need help?

Compatibility

+
=
Not enough data

1 person says it works.
0 people say it's broken.

100,1,1 100,1,1
100,1,1 100,1,1 100,1,1 100,4,4
100,1,1
100,1,1
100,2,2 100,2,2
100,1,1 100,1,1
100,2,2
100,3,3
100,1,1
100,3,3
100,1,1
100,1,1 100,1,1 100,1,1 100,1,1
100,1,1