Skip to content

Instantly share code, notes, and snippets.

@jo-snips
Created March 19, 2012 21:04
Show Gist options
  • Save jo-snips/2127103 to your computer and use it in GitHub Desktop.
Save jo-snips/2127103 to your computer and use it in GitHub Desktop.
Thesis: Filter Body Classes
// Add a class for styling
function add_classes($classes) {
if('tribe_events' == get_post_type()) {
if ( is_single() && !tribe_is_showing_all() ) { // single event
$classes[] = 'single-event';
} elseif ( tribe_is_upcoming() || tribe_is_past() || tribe_is_day() || (is_single() && tribe_is_showing_all()) ) { // list view
$classes[] = 'list';
} else { // grid view
$classes[] = 'grid';
}
} else {
}
return $classes;
}
add_filter('thesis_body_classes', 'add_classes');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment