Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

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); ?>>
share|improve this answer
    
Beautiful! Thanks very much. –  Christopher Jan 25 '13 at 16:27
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.