<?php
// Check to see if the header image has been removed
$header_image = get_header_image();
if ( $header_image ) :
// We need to figure out what the minimum width should be for our featured image.
// This result would be the suggested width if the theme were to implement flexible widths.
$header_image_width = get_theme_support( 'custom-header', 'width' ); ?>
<a href="<?php echo esc_url( home_url( '/' ) ); ?>">
<?php
// The header image
$header_image_width = get_custom_header()->width;
$header_image_height = get_custom_header()->height;
?>
<img src="<?php header_image(); ?>" width="<?php echo $header_image_width; ?>" height="<?php echo $header_image_height; ?>" alt="" />
</a>
<?php endif; // end check for removed header image ?>