/** wp_includes/vars.php * * * * * */ add_filter('body_class','add_body_class'); function add_body_class($class) { /** * body class への追加 * * example * * $classes= array('追加クラス名1'、'追加クラス名2'); * */ $classes= array(); $classes= array_merge($classes,$class); global $is_lynx, $is_gecko, $is_IE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone; switch(true){ case($is_lynx): $classes[] = 'lynx'; break; case($is_gecko): $classes[] = 'gecko'; break; case($is_IE): preg_match(" |(MSIE )([0-9])(\.) |si",$_SERVER['HTTP_USER_AGENT'],$regs); $classes[] = 'ie'.$regs[2]; break; case($is_opera): $classes[] = 'opera'; break; case($is_NS4): $classes[] = 'ns4'; break; case($is_safari): $classes[] = 'safari'; break; case($is_chrome): $classes[] = 'chrome'; break; case($is_iphone): $classes[] = 'iphone'; break; default: $classes[] = 'unknown'; break; } return $classes; }