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'd like to remove the header image on all the pages except my "home"-page.

Any ideas?

Thks

share|improve this question
add comment

3 Answers

Edit the header.php file and modify the following lines (probably around line 78-82):

Before

        <?php
            // Check to see if the header image has been removed
            $header_image = get_header_image();
            if ( ! empty( $header_image ) ) :
        ?>

After

        <?php
            // Check to see if the header image has been removed
            $header_image = get_header_image();
            if ( ! empty( $header_image ) && is_front_page() ) :
        ?>
share|improve this answer
    
Actually, I think you want to use is_front_page() rather than is_home(). The former returns true when the site front page is displayed, while the latter returns true when the blog posts index is being displayed. –  Chip Bennett Oct 13 '11 at 18:31
    
@Chip Bennett Good point. Fixed. –  Doug Oct 13 '11 at 18:33
    
Thank you very much! It works! –  Highlander Oct 14 '11 at 18:36
    
in a child them, we can do this with template files, but can we do this in function.php file? this will be awesome. –  Thanh-Cong Vo Jan 6 '12 at 5:39
add comment

This worked for me.

Change

if ( $header_image) :

to

if ( $header_image && is_front_page()) :

share|improve this answer
add comment

Remove the header image code from your category, post, single, etc files (leaving it in the index.php file).

If that is not of help, please explain the structure of your theme as well as post some code for additional help.

share|improve this answer
    
The original question specified the Twenty Eleven theme. The header image code is in the header.php file, not in all those individual files (as is probably the case in 99.9% of all themes). –  Doug Oct 13 '11 at 18:32
    
no worries bro but thanks for toasting my bread. –  Devise Oct 13 '11 at 18:33
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.