Skip to content

Instantly share code, notes, and snippets.

@DenisLeblanc
Created January 21, 2015 20:28
Show Gist options
  • Save DenisLeblanc/d779e0fe3941ebfb8c22 to your computer and use it in GitHub Desktop.
Save DenisLeblanc/d779e0fe3941ebfb8c22 to your computer and use it in GitHub Desktop.
iPad and iPhone conditionals for WordPress
<?php
// CREATE IPAD AND IPHONE CONDITIONALS
function is_ipad() {
$is_ipad = (bool) strpos($_SERVER['HTTP_USER_AGENT'],'iPad');
if ($is_ipad)
return true;
else return false;
}
function is_iphone() {
$cn_is_iphone = (bool) strpos($_SERVER['HTTP_USER_AGENT'],'iPhone');
if ($cn_is_iphone)
return true;
else return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment