Take the 2-minute tour ×

I trying to create a child theme from theme twenty thirteen. One feature I want to add in my child theme is that I can specify (via Coding) a different header image on each page. I've asked the same for twenty eleven theme - therefore it worked (but was is was not implemented in a child theme).

Is there a way how I can do this within functions.php or do I need to override header.php like in twenty eleven?

    if ( is_home() ) $my_header_image = get_header_image(); //gets default header, specified in custom_header.php
    elseif ( is_page(26) ) $my_header_image =  get_bloginfo('stylesheet_directory').'/images/news_header.png";
    elseif ( is_page(N) ) ...
    else $my_header_image = get_header_image(); 
<img src="<?php echo $my_header_image; ?>" width="<?php echo $header_image_width; ?>" height="<?php echo $header_image_height; ?>" alt="" />

Regards, mybecks

share|improve this question

4 Answers 4

I don't see any hooks available to help you hook your function.

As you are using child theming, so take the copy of the header.php file from the parent twenty thirteen theme and paste it in the child theme folder and make the changes.

This will work.

share|improve this answer

You could add a custom field to the pages with the value being your image path and then code that variable in the header.php of your child theme.

Check out get_post_meta

It might look something like this if the field name was headerImage.

$headerImage = get_post_meta( get_the_ID(), $headerImage, true );

get_the_ID grabs the current post or page ID.

share|improve this answer

hmm i think you can do it only via css with the body class, you get body class that generate automatic from wp and via css and refer it into your html

via css .page-name .heade { your custom bg from here }

wish it work with you

share|improve this answer
more <html class="page_class"> then via css .page_class .header {background-color:red; and so on } –  Divme Oct 29 '13 at 10:12

The best way is to use conditional tags refer to this: WordPress codex and to call the header template which you want to use for that page.

For Example: <?php if ( is_home() ) : get_header( 'home-header' ); ?> For home page it calls home-header.php and so on you can do it according to your need.

share|improve this answer

Your Answer


