Created
August 2, 2012 21:27
-
-
Save ramseyp/3240813 to your computer and use it in GitHub Desktop.
wp_is_mobile - barebones usage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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