function custom_body_class($classes) { global $is_lynx, $is_gecko, $is_IE, $is_opera, $is_NS4, $is_safari, $is_chrome; // Top level if (is_handheld()) { $classes[] = "handheld"; } if (is_mobile()) { $classes[] = "mobile"; } if (is_ios()) { $classes[] = "ios"; } if (is_tablet()) { $classes[] = "tablet"; } // Specific if (is_iphone()) { $classes[] = "iphone"; } if (is_ipad()) { $classes[] = "ipad"; } if (is_ipod()) { $classes[] = "ipod"; } if (is_android()) { $classes[] = "android"; } if (is_blackberry()) { $classes[] = "blackberry"; } if (is_opera_mobile()) { $classes[] = "opera-mobile"; } if (is_palm()) { $classes[] = "palm"; } if (is_symbian()) { $classes[] = "symbian"; } if (is_windows_mobile()) { $classes[] = "windows-mobile"; } if (is_lg()) { $classes[] = "lg"; } if (is_motorola()) { $classes[] = "motorola"; } if (is_nokia()) { $classes[] = "nokia"; } if (is_samsung()) { $classes[] = "samsung"; } if (is_samsung_galaxy_tab()) { $classes[] = "samsung-galaxy-tab"; } if (is_sony_ericsson()) { $classes[] = "sony-ericsson"; } if (is_nintendo()) { $classes[] = "nintendo"; } // Computer browser if (!is_handheld()) { $classes[] = "desktop"; } if ($is_lynx) { $classes[] = "lynx"; } if ($is_gecko) { $classes[] = "gecko"; } if ($is_opera) { $classes[] = "opera"; } if ($is_NS4) { $classes[] = "ns4"; } if ($is_safari) { $classes[] = "safari"; } if ($is_chrome) { $classes[] = "chrome"; } if ($is_IE) { $classes[] = "ie"; } // IE Version check $ie_check = array(); $ie_classes = array('ie7', 'ie8', 'ie9', 'ie10'); $version = 7; while ($version < 11) { $ie_check[] = strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE ' . $version . '.') !== FALSE; ++$version; } $ie = ''; foreach ($ie_check as $key => $value) { if ($value == 1) { $ie = $ie_classes[$key] . ' oldie'; } } $classes[] = $ie; // Check user logged in? if (!is_user_logged_in()) { $classes[] = 'not-login'; } return $classes; }
function mobble_body_class($classes) { global $is_lynx, $is_gecko, $is_IE, $is_opera, $is_NS4, $is_safari, $is_chrome, $mobble_detect; // top level if (is_handheld()) { $classes[] = "handheld"; } if (is_mobile()) { $classes[] = "mobile"; } if (is_ios()) { $classes[] = "ios"; } if (is_tablet()) { $classes[] = "tablet"; } // specific if (is_iphone()) { $classes[] = "iphone"; } if (is_ipad()) { $classes[] = "ipad"; } if (is_ipod()) { $classes[] = "ipod"; } if (is_android()) { $classes[] = "android"; } if (is_blackberry()) { $classes[] = "blackberry"; } if (is_opera_mobile()) { $classes[] = "opera-mobile"; } if (is_webos()) { $classes[] = "webos"; } if (is_symbian()) { $classes[] = "symbian"; } if (is_windows_mobile()) { $classes[] = "windows-mobile"; } //if (is_lg()) { $classes[] = "lg"; } if (is_motorola()) { $classes[] = "motorola"; } //if (is_smartphone()) { $classes[] = "smartphone"; } //if (is_nokia()) { $classes[] = "nokia"; } if (is_samsung()) { $classes[] = "samsung"; } if (is_samsung_tablet()) { $classes[] = "samsung-tablet"; } if (is_sony_ericsson()) { $classes[] = "sony-ericsson"; } if (is_nintendo()) { $classes[] = "nintendo"; } // bonus if (!is_handheld()) { $classes[] = "desktop"; } if ($is_lynx) { $classes[] = "lynx"; } if ($is_gecko) { $classes[] = "gecko"; } if ($mobble_detect->is('Gecko')) { $classes[] = "gecko"; } if ($is_opera) { $classes[] = "opera"; } if ($mobble_detect->is('Opera')) { $classes[] = "opera"; } if ($is_NS4) { $classes[] = "ns4"; } if ($is_safari) { $classes[] = "safari"; } if ($mobble_detect->is('Safari')) { $classes[] = "safari"; } if ($is_chrome) { $classes[] = "chrome"; } if ($mobble_detect->is('Chrome')) { $classes[] = "chrome"; } if ($is_IE) { $classes[] = "ie"; } if ($mobble_detect->is('IE')) { $classes[] = "ie"; } return $classes; }