PenciDesign Supporter replied
Hi,
By default, the category ID is not included in the body class for single posts. If you would like to customize styles based on the category ID body class, you will need to add custom code to display it.
You should paste this code into the function.php of the child theme or via the CodeSnippet plugin here: https://wordpress.org/plugins/code-snippets/
add_filter( 'body_class', function( $classes ) {
if ( is_single() ) {
$categories = get_the_category();
if ( ! empty( $categories ) ) {
foreach ( $categories as $category ) {
$classes[] = 'category-' . $category->term_id;
}
}
}
return $classes;
} );
Regards,
PenciDesign.
