Wordpress - Detecting Mobile Devices Accessing Your Site


/ Published in: PHP
Save to your folder(s)

From Web Design Ledger "13 Useful Code Snippets for WordPress Development"


Copy this code and paste it in your HTML
  1. include('mobile_device_detect.php');
  2. $mobile = mobile_device_detect();
  3.  
  4. if ($mobile==true) {
  5. // Edit this URL to point to the location you'd like to redirect to
  6. header( 'Location: http://your-website.com/?theme=Your_Mobile_Theme' ) ;
  7. }

URL: http://webdesignledger.com/tips/13-useful-code-snippets-for-wordpress-development

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.