I have one website www.example.com it has 5 pages lets say
www.example.com
www.example.com/about-us
www.example.com/terms-of-use
www.example.com/privacy-policy
www.example.com/apps
Now in the last page which is www.example.com/apps, I want following code to be executed in apps landing page:
$user_agent = $_SERVER['HTTP_USER_AGENT'];
if(strpos($user_agent, "Win") !== FALSE){
$url = "http://www.example.com";
}elseif(strpos($user_agent, "Mac") !== FALSE){
$url = "https://itunes.apple.com/us/app/exmaple/idwewew?ls=1&mt=8";
}elseif(strpos($user_agent, "Android") !== FALSE){
$url = "https://play.google.com/store/apps/details?id=com.example";
}
wp_redirect($url, 302); exit;
Which means If user access this page from windows device it will redirect user to home page, if user access this page from android device then goes to google play store and similarly for iOS device...
Now when I put this code in edit page, it wont work...I am using PHP Code Widget plugin
Please help...