WordPress.org

Ready to get started?Download WordPress

Plugin Directory

mobble

Helper plugin that provides conditional functions for detecting a variety of mobile devices & tablets. Perfect accompaniment to CSS Media Queries.

What functions are available?

The most useful ones are:

<?php 
is_handheld(); // any handheld device (phone, tablet, Nintendo)
is_mobile(); // any type of mobile phone (iPhone, Android, etc)
is_tablet(); // any tablet device
is_ios(); // any Apple device (iPhone, iPad, iPod)
?>

You can also use:

<?php 
is_iphone();
is_ipad();
is_ipod();
is_android();
is_blackberry();
is_opera_mobile();
is_symbian();
is_kindle();
is_windows_mobile();
is_motorola();
is_samsung();
is_samsung_tablet();
is_sony_ericsson();
is_nintendo();
?>

Inspecting mobile-detect.php will also reveal some other useful tools.

Do you have any examples?

Yup. This first example disables the sidebar for mobile/phone devices:

<?php 
if (!is_mobile()) {
    get_sidebar();
}
?>

This second example loads a specific stylesheet for Apple devices (iPhone, iPod and iPad):

<?php 
if (is_ios()) {
    wp_enqueue_style('ios', get_template_directory_uri() . '/ios.css');
}
?>

Caching

Please note that in certain setups caching will cause undesired behaviour. If your cache is set too aggressively PHP will be skipped and the device detection will not work.

Requires: 3.0 or higher
Compatible up to: 3.8.3
Last Updated: 2013-2-18
Downloads: 10,803

Ratings

4 stars
4.7 out of 5 stars

Support

5 of 8 support threads in the last two months have been resolved.

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

100,1,1
100,3,3
100,1,1 100,1,1
100,1,1
100,1,1
100,1,1 100,1,1
100,6,6