• WP category as class name

    <?php if (is_single()) {
    global $post;
    $cat='';
    $cats = get_the_category($post->ID);
    foreach ( $cats as $c ) {
    $cat .= $c->category_nicename.' ';
    }
    } ?>

    Add the code above to the header.php file before the tag
    <body <?php body_class($cat); ?>>


1111111