Support » Themes and Templates » please remove empty header image

  • First of all, twenty ten is a nice fresh default theme 🙂

    One request: after hitting “Remove header image” on the back end, so there is no header image set, the front still shows a big empty area where the image normally would show. This is because even without any header image defined there still is an image tag with height and width showing in the header source.

    This is simply resolved by adding a little if() in header.php like so:
    Replace line 64

    else : ?>


    elseif ( get_header_image() ) : ?>

    This causes the following line

    <img src="<?php header_image(); ?>" width="<?php echo HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" alt="" />

    to be ignored when there is no header image set ( which would otherwise result in that ugly empty src=”” )

    Thanks! 🙂

  • The topic ‘please remove empty header image’ is closed to new replies.