Add Custom Header To Home Page Only In Genesis

If you want to display a unique header image on the front page of your site which is different to what your other pages display, you’ll find one of the best solutions in this post.

1. First step is to remove support for a custom header if your child theme includes PHP code like this in your functions.php file:

//* Add support for custom header
add_theme_support( 'custom-header', array(
	'width'           => 1140,
	'height'          => 350,
	'header-selector' => '.site-title a',
	'header-text'     => false
) );

Different themes use different code however if your theme includes a function named add_theme_support(‘custom_header’), please remove it.

Note: You can leave the above code in some themes like the Genesis Sample theme and use it for your default header which displays on all pages excluding your home page and skip the 2nd step. Others will require you to remove it and use the code in the next step.

2. The 2nd step is to copy the following PHP code and paste it at the end of your child themes functions.php file.

Note: Both solutions require you to add this code as instructed.

Related Tutorials


Comments

2 responses to “Add Custom Header To Home Page Only In Genesis”

  1. Adam Abrams Avatar
    Adam Abrams

    Hi Brad! I’m a “moderately” experienced WordPress guy who’s trying to wrap his head around Genesis and it’s going well so far, but I’ve run into a real snag here. I’m wondering if you can tell me why my method (not quite as advanced as yours) isn’t working.

    I’ve removed the genesis_do_header action and replaced it with an alternative, as per your solution, but I’m trying simply to use some “if” logic in my alternate action. But it doesn’t work… and I’m wondering if there’s some special Genesis reason why.

    My code is here:

    https://gist.github.com/cosmocanuck/3b023045715f1be29738

    …but my homepage refuses to look any different.

    The key action is my if statement in lines 15-19. Is that kind of statement not allowed here?

    Hoping you can shine a little light on this one if you have a chance. Thanks!

    Adam

    1. Brad Dalton Avatar
      Brad Dalton

      Hello Adam

      Your code is nothing like what i’ve coded here.

      I would need to spend some time testing it.

Leave a Reply

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.