• Resolved stammo

    (@stammo)


    Trying to remove the header image links. I happen to have a header image that has some words in it. It appears to be able to link to something, but it just comes back to the main page. I have created a child theme and am hoping to kill the header image links, but wasn’t sure where it lived in the code.

    thanks!!

Viewing 9 replies - 1 through 9 (of 9 total)
  • Rajesh Soni

    (@rajeshsoni)

    Hello,

    1) WordPress admin backend -> Appearance -> Header (wp-admin/themes.php?page=custom-header&step=1, https://screencast.com/t/JBr1NygbM)

    2) Click on “Remove Header Image” button (https://screencast.com/t/7aWDY28eRY)

    3) Before the fix above: https://screencast.com/t/hKEnXZQ3LwQ

    4) After the fix above: https://screencast.com/t/2zyJ1DlknTE

    Cheers!

    RS

    Michael

    (@alchymyth)

    header.php;
    remove the first and last line from this section:

    <a href="<?php echo esc_url( home_url( '/' ) ); ?>">
    				<?php
    					// The header image
    					// Check if this is a post or page, if it has a thumbnail, and if it's a big one
    					if ( is_singular() && has_post_thumbnail( $post->ID ) &&
    							( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), array( $header_image_width, $header_image_width ) ) ) &&
    							$image[1] >= $header_image_width ) :
    						// Houston, we have a new header image!
    						echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' );
    					else :
    						// Compatibility with versions of WordPress prior to 3.4.
    						if ( function_exists( 'get_custom_header' ) ) {
    							$header_image_width  = get_custom_header()->width;
    							$header_image_height = get_custom_header()->height;
    						} else {
    							$header_image_width  = HEADER_IMAGE_WIDTH;
    							$header_image_height = HEADER_IMAGE_HEIGHT;
    						}
    						?>
    					<img src="<?php header_image(); ?>" width="<?php echo $header_image_width; ?>" height="<?php echo $header_image_height; ?>" alt="" />
    				<?php endif; // end check for featured image or standard header ?>
    			</a>
    Thread Starter stammo

    (@stammo)

    thanks. so this most recent removal of code will keep the header images (i also added a widget that makes it possible to use different images per page), but makes it so there is no link on the header image back to the home page? when hovering over the header image, it won’t appear to have a link to something?

    by first and last line you mean remove:
    first:
    “>
    last:
    <?php endif; // end check for featured image or standard header ?>

    or

    i’m super new at all of this and not entirely sure what i’m doing.

    thanks!!!

    Thread Starter stammo

    (@stammo)

    sorry. exactly which lines exactly do i remove?

    Rajesh Soni

    (@rajeshsoni)

    Let me answer that.

    Remove

    <a href="<?php echo esc_url( home_url( '/' ) ); ?>">

    and the ending

    </a>

    Hope that’s clear enough.
    If still not clear, check this: https://screencast.com/t/eQ3X2rT5U

    RS

    Thread Starter stammo

    (@stammo)

    Amazing!! Thank you so much!!

    Rajesh Soni

    (@rajeshsoni)

    No worries.

    Cheers

    Thanks Rajesh, just what I was looking for.

    You’re welcome @greggviro

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Remove Header Image Link from Twenty Eleven Theme’ is closed to new replies.