How to Detect Safari Browser on iOS

Well Safari browser is been used on many platforms, like MacBook, IPad, IPhone and etc. so how to check if the user is coming from IPhone or IPad and give him a different design or stylesheet, well that is pretty simple their is a variable in WordPress that allows us to detect whether the visitor is from the iPhone

So here’s the simple code for using in your WordPress site :

add_action('wp_print_styles', 'wpden_iphone_enqueue_styles');
function wpden_iphone_enqueue_styles(){
	global $is_iphone;
	if( $is_iphone ){
		wp_enqueue_style('iphone-css', get_stylesheet_directory_uri() . '/iphone.css' );
		wp_enqueue_style('default-css', get_stylesheet_directory_uri() . '/default.css' );

well the above code is pretty simple to understand that detect safari so i guess i do not need to give any such kind of explanation if you need more help, leave a comment below

Subscribe to WPDEN