Created
January 25, 2015 14:30
-
-
Save tahirtaous/b0a33d3640a0ab990824 to your computer and use it in GitHub Desktop.
This is a little-known built-in function of WordPress that detects whether a user is visiting on a mobile device or not and allows to display content accordingly. It is quite handy function for those willing to include a bit of code for only mobile users.//
This file contains hidden or 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
// This code will show message only on mobile devices | |
// only mobile users will see this message | |
// Source: https://www.cms2cms.com/blog/6-useful-yet-relatively-unknown-wordpress-functions/ | |
// Tested: WordPress 4.1 Jan 25 2015 | |
<?php if( wp_is_mobile() ) : ?> | |
Visit our website on your desktop for a richer user experience | |
<?php endif ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment