Return to Snippet

Revision: 67350
at September 13, 2014 09:58 by chrisaiv


Initial Code
/**
* Title: Detect Safari On iOS 
* 
* 
* @param string $role Role name.
* @param int $user_id (Optional) The ID of a user. Defaults to the current user.
* @return bool
*/
function add_ios_styles(){
  global $is_iphone;
  if( $is_iphone ){
    wp_enqueue_style('iphone-css', get_stylesheet_directory_uri() . '/iphone.css' );
  }
  else{
    wp_enqueue_style('common-css', get_stylesheet_directory_uri() . '/common.css' );
  }
}
add_action('wp_print_styles', 'add_ios_styles');

Initial URL
http://www.smashingmagazine.com/2011/12/07/10-tips-optimize-wordpress-theme/

Initial Description
It's probably not a good idea to always use this trick but if you need to, you'll be glad you bookmarked this script.

Initial Title
Wordpress: Detect Safari On iOS

Initial Tags
wordpress

Initial Language
PHP