Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 29th, 2012  |  syntax: None  |  size: 0.38 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. // add taxoonomy term to body_class
  2. function woo_custom_taxonomy_in_body_class( $classes ){
  3.   if( is_singular() )
  4.   {
  5.     $custom_terms = get_the_terms(0, 'product_cat');
  6.     if ($custom_terms) {
  7.       foreach ($custom_terms as $custom_term) {
  8.         $classes[] = $custom_term->slug;
  9.       }
  10.     }
  11.   }
  12.   return $classes;
  13. }
  14.  
  15. add_filter( 'body_class', 'woo_custom_taxonomy_in_body_class' );