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', '//', '1' , 0);
Job done ! Now test.
This snippet ensures that detection will only take place on the standard pages for the WordPress website, not the admin pages. For best results enable ‘Smart Redirection’ on your website settings in Handset Detection.

Still need help? Contact Us Contact Us