Created
June 9, 2013 20:08
-
-
Save xafarali/5745004 to your computer and use it in GitHub Desktop.
Custom Body class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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