Device Detection with Wordpress
There's a few ways you can include the Handset Detection script in your Wordpress site. Perhaps the easiest method is
1) Login to Handset Detection, create your site and setup any redirection rules.
2) After you’ve completed that grab the Site ID, this is the unique number which we use to reference your site internally.
Paste the snippet below into your wordpress theme’s function.php file by Logging in to WordPress, then click Dashboard > Appearance > Editor. From the menu on the right hand side choose the Theme Functions (functions.php) file.
Copy and the snippet below and paste it into the very end of the file.
After pasting, substitute your Site ID for xxx, then save the file.
/** ** Handset Detection **/ if (! is_admin()) { wp_enqueue_script('handsetdetection', '//api.handsetdetection.com/apiv4/js/xxx.js', '1' , 0); }
Job done ! Now test.