//-------------------category class body----------------- function an_body_class_add_categories( $classes ) { // Only proceed on a single post page if ( !is_single() ) return $classes; // Get the categories that are assigned to this post $post_categories = get_the_category(); // Loop over each category in the $categories array foreach( $post_categories as $current_category ) { // Add the current category's slug to the $body_classes array $classes[] = $current_category->slug; } // return the $body_classes array return $classes; } add_filter( 'body_class', 'an_body_class_add_categories' ); //ref: à compléter