Skip to content

Instantly share code, notes, and snippets.

@roachhd
Created September 20, 2014 15:19
Show Gist options
  • Save roachhd/530569b61813fdf96029 to your computer and use it in GitHub Desktop.
Save roachhd/530569b61813fdf96029 to your computer and use it in GitHub Desktop.
for adding a second theme to use a a mobile them to a wordpress site
<?php
include("Mobile_Detect.php");
$detect = new Mobile_Detect();
if (!$_SESSION['switched']
&& !is_admin()
&& $detect->isMobile()
&& empty($_REQUEST['wptheme'])
&& get_current_theme() != 'My%20Mobile%20Page%20V3%20Wordpress%20Theme') {
$_SESSION['switched'] = true;
header('Location: http://yourwebsiteurl.com?wptheme=My%20Mobile%20Page%20V3%20Wordpress%20Theme');
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment