<?php
$home_class = '';
if(is_product_category('dairy')) {
$home_class = 'dairy-header';
}
elseif(is_product_category('home')) {
$home_class = 'home-header';
} elseif(is_product_category('wellness')) {
$home_class = 'wellness-header';
}
?>
<header class="header <?php echo $home_class; ?>">
join()
if ( is_single() ) {
global $post;
foreach( get_the_category($post->ID) as $category ) {
$classes[] = $category->category_nicename;
}
}
body_class()
и post_class()
или эту статью