Helper plugin that provides conditional functions for detecting a variety of mobile devices & tablets. Perfect accompaniment to CSS Media Queries.
The most useful ones are:
<?php
is_handheld(); // any handheld device (phone, tablet, Nintendo)
is_mobile(); // any type of mobile phone (iPhone, Android, Nokia etc)
is_tablet(); // any tablet device (currently iPad, Galaxy Tab)
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_palm();
is_symbian();
is_windows_mobile();
is_lg();
is_motorola();
is_nokia();
is_samsung();
is_samsung_galaxy_tab();
is_sony_ericsson();
is_nintendo();
?>
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');
}
?>
Requires: 3.0 or higher
Compatible up to: 3.2.1
Last Updated: 2011-8-10
Downloads: 838
Got something to say? Need help?