Skip to content

Instantly share code, notes, and snippets.

@xafarali
Created June 9, 2013 20:08
Show Gist options
  • Save xafarali/5745004 to your computer and use it in GitHub Desktop.
Save xafarali/5745004 to your computer and use it in GitHub Desktop.
Custom Body class
// Body Class
function add_body_class( $classes )
{
global $is_iphone;
global $post;
if ( isset( $post ) ) {
$classes[] = $post->post_type . '-' . $post->post_name;
}
if($is_iphone) $classes[] = 'iphone';
return $classes;
}
add_filter( 'body_class', 'add_body_class' );
//-----------------------------------------------
function detect_iphone($iphone) {
global $is_iphone;
if($is_iphone) $iphone[] = 'iphone';
return $iphone;
}
add_filter('body_class','detect_iphone');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment