WordPress.org

Support

Support » Plugins and Hacks » Hacks » Removing Featured image from header

Removing Featured image from header

  • Hi there,

    I’m building my first plug-in here, and I created a new post type. Now whenever I make one of these posts, the header takes my Featured image instead of my normal header image. I hate it.

    So, can anybody please tell me how to get rid of it? Overide this function, or prevent it from ever happening?

    Running Graphene theme on wordpress 3.0.4

Viewing 7 replies - 1 through 7 (of 7 total)
  • Btw, i need this featured post image for display on the page, so removing this image itself won’t help.

    I also only seem to have the problem with bigger pictures.

    Hi mrpaplu,

    I had the same problem and had a hard time solving it, but I found a solution!

    I read an article that says that if thumbnail width >= header width then it uses the thumbnail as a header replacement.

    If you are using the functionality the same way as I do, you don’t want the thumbnail to be that big anyway so what you may have to do (espacially if your theme is based on twenty ten) is :

    1. open functions.php
    2. find this line : set_post_thumbnail_size( HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT, true );
    3. Make it a comment using /* */
    4. Add a line under this line that looks like this : set_post_thumbnail_size( width, height, true/false );

    BINGO!

    Problem solved!

    Hope this will help you!

    Julien

    Hi there, I’ve been having this same issue but the 4 steps above isn’t helping me. I’m running WP 3.1.2 and modifying the twentyten theme. Cheers!

    Michael

    @alchymyth

    Forum Moderator

    @jvandelaar

    if you don’t want this feature, you need to remove the corresponding code from header.php of twenty ten:

    <?php
    					// Check if this is a post or page, if it has a thumbnail, and if it's a big one
    					if ( is_singular() && current_theme_supports( 'post-thumbnails' ) &&
    							has_post_thumbnail( $post->ID ) &&
    							( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'post-thumbnail' ) ) &&
    							$image[1] >= HEADER_IMAGE_WIDTH ) :
    						// Houston, we have a new header image!
    						echo get_the_post_thumbnail( $post->ID );
    					elseif ( get_header_image() ) : ?>
    						<img src="<?php header_image(); ?>" width="<?php echo HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" alt="" />
    					<?php endif; ?>

    leave only:

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

    Better still, learn how child themes work and create a new header.php in your child theme. Then you won’t lose your edits when upgrading.

    Awesome thanks! Worked a treat and yes I will learn about the child themes.

    I was starting to load the header using the css file which worked, but not as lushly as what alchymyth had described. Cheers!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Removing Featured image from header’ is closed to new replies.
Skip to toolbar