Why isn’t is_page_template() adding a body class?

I want to conditionally add a body class depending on what template is being used.

I can’t figure out why the following code is not working…

function damsonhomes_body_classes( $classes ) {

  if (is_page_template('single.php')) {

    $classes[] = 'sans-hero';

  }

  return $classes;

}

add_filter( 'body_class', 'damsonhomes_body_classes');

Thanks all

Read more here: Why isn’t is_page_template() adding a body class?

Leave a Reply

Your email address will not be published. Required fields are marked *