Skip to content

Instantly share code, notes, and snippets.

@ramseyp
Created August 2, 2012 21:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ramseyp/3240813 to your computer and use it in GitHub Desktop.
Save ramseyp/3240813 to your computer and use it in GitHub Desktop.
wp_is_mobile - barebones usage
<?php
/**
*
* Test for mobile browsers - if wp_is_mobile is true, then do something.
*
*/
if ( wp_is_mobile() ) {
echo "Do Something if it's a mobile device";
}
/**
*
* Test for the negative (it's not a mobile browser) - if wp_is_mobile is false, then do something
* else do some other thing.
*/
if ( !wp_is_mobile() ) {
echo "I'm not a mobile browser.";
} else {
echo "Full of Mobile Goodness.";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment