• Joe Streno

    (@butisitart)


    Hi Ben …

    I have read the WP Codex and am told:

    If you want to change more than just the stylesheet, your child theme can override any file in the parent theme: simply include a file of the same name in the child theme directory, and it will override the equivalent file in the parent theme directory when your site loads. For instance, if you want to change the PHP code for the site header, you can include a header.php in your child theme’s directory, and that file will be used instead of the parent theme’s header.php.

    If I do just as I’m told put a copy of header.php in my child folder & add php code to the child hearer.php file … the new code does not show up in my website.

    If I take the same code and at it to the parent header.php file … it works.

    Color me baffled. I’m doing exactly what the Codex says, but not getting the results I’m told I will.

    My child css file works as advertised … but can’t get a child header.php file to work for the life of me!

    Help!

    Thanks … Joe
    http://www.go2jo.com

Viewing 5 replies - 1 through 5 (of 5 total)
  • Theme Author Ben Sibley

    (@bensibley)

    Hey Joe,

    Okay I’ve got a few things for you to try. First, double-check that the header.php file is included on the server.

    Secondly, add something to header.php that will be very obvious if it is working. For instance, add a random paragraph of text that will show at the top of the site. This way we can rule out any issues with the code itself added to the header.php file.

    If neither of these leads you to a solution, please share a copy of your child theme here. Then, I’ll install it and check it out first-hand.

    Thread Starter Joe Streno

    (@butisitart)

    Hi Ben …

    I was using Yoast SEO’s Breadcrumbs php in the parent header.php and it was working fine. When I copied the same header.php file with the same code to the child theme, and removed the Yoast code from the parent theme, it stopped working.

    <!--  Yoast Breadcrumbs  -->
            <?php if ( function_exists('yoast_breadcrumb') ) {
    yoast_breadcrumb('<p id="breadcrumbs">','</p>');
    } ?>
    <!--  End Yoast Breadcrumb  -->

    I also tried adding
    <strong>THIS IS A TEST</strong>
    in child header.php and it didn’t work either.

    DropBox link to my tracks-child theme folder. <— Please delete link when done? Thanks.

    Have YOU been able to get a header.php file working in ANY theme you’ve tried?

    Theme Author Ben Sibley

    (@bensibley)

    Thanks!

    I’ve never had any problem with parent themes not respecting the files in the child theme. I didn’t have the SEO plugin active, but I added a string of text and it showed up in the header while using the child theme you shared so I know the child theme’s header.php was being used (not sure how to delete the link, but I’ve got a copy now thanks).

    I have a few more things to try out:

    1. Empty your cache if you’re using any caching plugins
    2. Try a different function in place of the yoast breadcrumbs
    3. If the header.php still won’t work, try adding the breadcrumb function at the very bottom of the menu-primary.php file instead (after copying it into your child theme).

    Thread Starter Joe Streno

    (@butisitart)

    I had added text to the child head.php and it didn’t show up in my installation. So I’m still stumped. I’ll keep trying things on my end too. Thanks

    I’m also using Yoast SEO’s plugin. I added the breadcrumbs code to the header.php and uploaded it to tracks-child folder. It worked for me.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘tracks-child : header.php not working’ is closed to new replies.