Select Page

If you want to customise the CSS styling on a particular page, you can assign a body class using the body_class filter.

Simply add the following code to your functions.php file and replace ‘blog’ with the slug of your page and ‘wpt-blog’ with your class name:


function wpt_filter_body_class( $classes ) {
if( is_page( 'blog' ) ) {
$classes[] = 'wpt-blog';

return $classes;
}
else {

return $classes;
}
}
add_filter( 'body_class', 'wpt_filter_body_class' );

Genius!

Share This