Using the following code to try and add the page slug as a class to my body tag but as yet having no success, could anyone advise how I might achieve this?
PHP added in functions.php
function add_body_class( $classes )
{
global $post;
if ( isset( $post ) ) {
$classes[] = $post->post_type . '-' . $post->post_name;
}
return $classes;
}
add_filter( 'body_class', 'add_body_class' );