How do I initiate Thematics Dynamic Body Classes or is that automatically set to run?
ThemeShaper Forums » Thematic
Dynamic Body Classes
(10 posts)-
Posted 6 years ago #
-
put this in your function.php file
define('THEMATIC_COMPATIBLE_BODY_CLASS', true);
define('THEMATIC_COMPATIBLE_POST_CLASS', true);Posted 6 years ago # -
epic awesomeness, THANK YOU!!!
Posted 6 years ago # -
all good in lala land.
Posted 6 years ago # -
Just a note: IE9 (and probably 10) aren't defined yet.
The function to redefine is browser_class_names($classes). I'm working on filtering that right now, will post back code here in a little bit.
Posted 6 years ago # -
Add this to your childtheme functions. I'm making a HUGE assumption that IE 10 is going to show up with its version as I listed below. Who knows, maybe they'll call it "Version HAHAHATAKETHATWLANNI!!!"
//add IE9, IE10 to body class function add_ie_browser_class_names($classes) { // add 'class-name' to the $classes array // $classes[] = 'class-name'; $browser = $_SERVER[ 'HTTP_USER_AGENT' ]; // Checks browsers in this order: Chrome, Safari, Opera, MSIE, FF if ( preg_match( "/MSIE/", $browser ) ) { //$classes[] = 'msie'; if ( preg_match( "/MSIE 9.0/", $browser) ) { $classes[] = 'ie9'; } elseif ( preg_match( "/MSIE 10.0/", $browser) ) { $classes[] = 'ie10'; } } // return the $classes array return $classes; } add_filter('thematic_body_class', 'add_ie_browser_class_names');
Posted 6 years ago # -
Whoops!
//add IE9, IE10 to body class function add_ie_browser_class_names($classes) { // add 'class-name' to the $classes array // $classes[] = 'class-name'; $browser = $_SERVER[ 'HTTP_USER_AGENT' ]; if ( preg_match( "/MSIE/", $browser ) ) { //$classes[] = 'msie'; if ( preg_match( "/MSIE 9.0/", $browser) ) { $classes[] = 'ie9'; } elseif ( preg_match( "/MSIE 10.0/", $browser) ) { $classes[] = 'ie10'; } } // return the $classes array return $classes; } add_filter('thematic_body_class', 'add_ie_browser_class_names');
Posted 6 years ago # -
Hey Driftwood, would you set this to resolved if it is resolved?
Posted 6 years ago # -
Will be included in a couple of days. Added some new stuff that needs some documentation.
Chris
Posted 6 years ago # -
As an update, here's some mobile body classes. I'm not 100% the iemobile one works yet, if anyone has a windows phone 7, can you test?
//add mobile browsers function mobile_body_class($classes) { $browser = $_SERVER[ 'HTTP_USER_AGENT' ]; if ( preg_match( "/iPhone/", $browser ) ){ $classes[] = 'mobile-safari mobile'; } elseif ( preg_match( "/Android/", $browser ) ) { $classes[] = 'mobile-android mobile'; } elseif ( preg_match( "/iemobile/", $browser) ) { $classes[] = 'mobile-ie mobile'; } return $classes; } add_filter('thematic_body_class','mobile_body_class');
Posted 6 years ago #
Topic Closed
This topic has been closed to new replies.