WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/has header image

Description

Check whether a header image for the current theme is set or not.

Usage

<?php has_header_image() ?>

Parameters

None.

Return Values

(bool) 
Returns true if a header image has been set, otherwise false if:
  • The current theme does NOT support header images. (Learn how to enable it in Custom Headers page).
  • The current theme DOES support header images. However, the user has selected the "Remove Header Image" option from the Appearance -> Header screen.

Examples

<?php if ( has_header_image() ) { ?>
<img src="<?php echo( get_header_image() ); ?>" alt="<?php echo( get_bloginfo( 'title' ) ); ?>" />
<?php } ?>

Change Log

Since: 4.2.0

Source File

has_header_image() is located in wp-includes/theme.php.

Related

See also index of Function Reference and index of Template Tags.