Sometimes adding a page slug to the body class makes all the difference. Styling the page through CSS makes it that much easier.

Copy this code snippet in your WordPress theme’s functions.php to add a page slug body class to your pages.


function add_slug_body_class( $classes ) {
	global $post;
		if ( isset( $post ) ) {
		$classes[] = $post->post_type . '-' . $post->post_name;
	return $classes;
add_filter( 'body_class', 'add_slug_body_class' );