• Hey all, something of a WordPress noob and not really php savvy. I’m good with HTML and CSS though.

    Here is my dilemma. I am making a site that I am creating a child theme for from the Responsive theme and I want the home page to have a different header than all other pages.

    I’ve read the Functions content in the WordPress codex but I’m not sure how to use it exactly, especially with a child theme.

    This is the code I got from the codex, but I have some questions….

    <?php
    if ( is_home() ) :
    	get_header( 'home' );
    elseif ( is_404() ) :
    	get_header( '404' );
    else :
    	get_header();
    endif;
    ?>

    1. Where do I put this bit of code? Do I have to put it in every other php template such as single.php and page.php?

    2. Where it asks “is_home”, how does it determine the page “name” is “home”? Where does it grab that information?

    3. When it calls out “get_header(‘home’)”, I’m guessing I can just rename home with the file name “header.php” without the quotes. Right?

    4. Under the “else” I’m guessing I would put the custom header in the parenthesis inside ‘ ‘ … Like this… get_header(‘header-custom.php’); Right?

    5. Where do I find the name “home” from is_home in the php files that come with the theme? Or is that from a setting in the WordPress back end?

    6. Can I remove these lines safely?

    elseif ( is_404() ) :
    	get_header( '404' );

    Sorry if this isn’t clear enough. Thanks in advance for any help.

Viewing 1 replies (of 1 total)
  • 1. No, just put it in the template you want to have a different header.

    2. WordPress automatically appends the class “home” to the home page.

    3. I’m not sure; try it and see. (It’s how I’ve learned most of what I know about PHP, anyway.}

    4. No, I’m pretty sure you can leave it with get_header(). You can check the WordPress function reference for that function to see if it takes arguments.

    5. “home” is WordPress core, afaik.

    6. Yes.

Viewing 1 replies (of 1 total)
  • The topic ‘Get Header Child Theme’ is closed to new replies.