wp_is_mobile [ WordPress Functions ]
wp_is_mobile ( No parameters )
| Returns: |
|
| Defined at: |
|
| Codex |
Test if the current browser runs on a mobile device (smart phone, tablet, etc.)
Source
function wp_is_mobile() {
static $is_mobile;
if ( isset($is_mobile) )
return $is_mobile;
if ( empty($_SERVER['HTTP_USER_AGENT']) ) {
$is_mobile = false;
} elseif ( strpos($_SERVER['HTTP_USER_AGENT'], 'Mobile') !== false // many mobile devices (all iPhone, iPad, etc.)
|| strpos($_SERVER['HTTP_USER_AGENT'], 'Android') !== false
|| strpos($_SERVER['HTTP_USER_AGENT'], 'Silk/') !== false
|| strpos($_SERVER['HTTP_USER_AGENT'], 'Kindle') !== false
|| strpos($_SERVER['HTTP_USER_AGENT'], 'BlackBerry') !== false
|| strpos($_SERVER['HTTP_USER_AGENT'], 'Opera Mini') !== false
|| strpos($_SERVER['HTTP_USER_AGENT'], 'Opera Mobi') !== false ) {
$is_mobile = true;
} else {
$is_mobile = false;
}
return $is_mobile;
}Examples [ wp-snippets.com ]
Top Google Search Results
- Function Reference/wp is mobile « WordPress Codex
Description. This Conditional Tag checks if the user is visiting using a mobile device. This is a boolean function, meaning it returns either TRUE or FALSE.
codex.wordpress.org - Fatal error:Call to undefined function wp_is_mobile - WordPress
[resolved] Fatal error:Call to undefined function wp_is_mobile (22 posts). TinTeddy. Member Posted 11 months ago #. Sorry to have to ask, but I can't get to my ...
wordpress.org - Fatal error: Call to undefined function wp_is_mobile() in ... - WordPress
Not sure what to do. I tried reading what others sis for this error and I am not sure what some of it means. Could anyone break things down a little more.
wordpress.org - Better mobile detection with wp_is_mobile() and Mobble - slash25 ...
Aug 2, 2012 ... WordPress 3.4 is more “mobile-friendly” with the introduction of a new function: wp_is_mobile(). This function checks for a mobile user agent.
slash25.com
