npI'm using Divi and trying to get the project tags to appear as classes inside the relevant to that project, so i can then style the project depending on its tags.
I have this code snippet
function add_tags_to_body_class( $classes ) {
if( ( is_page() || is_single() )
&& $tags = get_the_tags( get_queried_object_id() ) ){
foreach( $tags as $tag ) {
$classes[] = $tag->name;
}
}
return $classes;
}
add_filter( 'body_class', 'add_tags_to_body_class' );
This works really well on Posts but not so well on Divi Projects.
It does add a class to the project template but unfortunately not to the body class, instead it adds it inside the page-container div. This means that when you apply a Divi template to the project all of these additional classes are stripped out.
can anyone help?