Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question
    
Please add code to your question, so that we can help answer it. –  Chip Bennett Sep 3 '12 at 4:26
add comment

1 Answer

up vote 1 down vote accepted

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 
} 
share|improve this answer
    
Here is the template I downloaded github.com/simplethemes/skeleton_wp I am using the child theme and I am pretty new to wordpress. –  Nick Ennis Sep 3 '12 at 19:53
    
Did my solution work for you? –  toscho Sep 3 '12 at 20:04
    
// Houston, we have a solution. Thanks allot –  Nick Ennis Sep 3 '12 at 20:52
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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