1

I'd like to remove the header image on all the pages except my "home"-page.

Any ideas?

Thks

3 Answers 3

3

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() ) :
        ?>
3
  • 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. Commented Oct 13, 2011 at 18:31
  • @Chip Bennett Good point. Fixed.
    – Doug
    Commented Oct 13, 2011 at 18:33
  • in a child them, we can do this with template files, but can we do this in function.php file? this will be awesome. Commented Jan 6, 2012 at 5:39
2

This worked for me.

Change

if ( $header_image) :

to

if ( $header_image && is_front_page()) :

0

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.

2
  • 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
    Commented Oct 13, 2011 at 18:32
  • no worries bro but thanks for toasting my bread.
    – Devise
    Commented Oct 13, 2011 at 18:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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