I thought there was a conditional for a custom image header that could check whether an image had been added (not whether the feature was enabled, but actually being used). I wanted to use it to add a body class, but I can't find it again. Does anyone know of how to check if the site has a custom header?
1 Answer
you could try the following right before you call the body_class()
function:
<?php
$header_image = get_header_image();
if( !empty( $header_image) ){
$custom_body_class = 'has-header-image';
} else {
$custom_body_class = 'no-header-image';
}
?>
<body <?php body_class($custom_body_class); ?>>