0

I'm using the Skeleton theme and the header image is on all pages. I only want it on the home page. Anyone got a solution?

  • Please add code to your question, so that we can help answer it. – Chip Bennett Sep 3 '12 at 4:26
1

The following one-liner removes regular header images:

! is_admin() && is_front_page() && add_filter( 'theme_mod_header_image', '__return_false' );

Usually, header images are saved and retrieved per Theme Modification API, which offers the same filter scheme "theme_mod_$name" for all theme data.

Update

I see now, the theme is using the post thumbnail as header images on single views:

<?php
// Check if this is a post or page, if it has a thumbnail, and if it exceeds defined HEADER_IMAGE_WIDTH
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!
$image_attr = array(
            'class' => "scale-with-grid",
            'alt'   => trim(strip_tags( $attachment->post_excerpt )),
            'title' => trim(strip_tags( $attachment->post_title ))
            );
echo '<div id="header_image" class="row sixteen columns">'.get_the_post_thumbnail( $post->ID, array("HEADER_IMAGE_WIDTH","HEADER_IMAGE_HEIGHT"), $image_attr ).'</div>';
elseif ( get_header_image() ) : ?>
    <div id="header_image" class="row sixteen columns"><img class="scale-with-grid round" src="<?php header_image(); ?>" alt="" /></div>
<?php endif; ?> 

You have to remove that code in your child theme and replace it with:

if ( is_front_page() && get_header_image() )
{ 
?>
<div id="header_image" class="row sixteen columns">
    <img class="scale-with-grid round" src="<?php header_image(); ?>" alt="" />
</div>
<?php 
} 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.