Created
June 28, 2014 07:27
-
-
Save palpalani/c77657fe7a224e031379 to your computer and use it in GitHub Desktop.
WordPress - Detecting Mobile Visitors of Your Website
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
Like strip_shortcodes(), wp_is_mobile() is also easy to explain: It allows you to detect users that are using mobile devices to connect to your website. | |
Usage | |
<?php | |
if( wp_is_mobile() ) { | |
// echo the "HAVE YOU TRIED OUR AWESOME MOBILE APP?" banner | |
} else { | |
// don't echo the banner | |
} | |
?> | |
A perfect Adaptive Web Design tool, if you ask me. Plus, you can remove some elements that are irrelevant for mobile users, or add some like a banner for your mobile application. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment