WordPress.org

Forums

Removing Featured image from header (8 posts)

  1. mrpaplu
    Member
    Posted 4 years ago #

    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

  2. mrpaplu
    Member
    Posted 4 years ago #

    Btw, i need this featured post image for display on the page, so removing this image itself won't help.

  3. mrpaplu
    Member
    Posted 4 years ago #

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

  4. jbonnier
    Member
    Posted 4 years ago #

    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

  5. jvandelaar
    Member
    Posted 4 years ago #

    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!

  6. alchymyth
    Forum Moderator
    Posted 4 years ago #

    @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; ?>
  7. GRAQ
    Member
    Posted 4 years ago #

    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.

  8. jvandelaar
    Member
    Posted 4 years ago #

    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!

Topic Closed

This topic has been closed to new replies.

About this Topic