Header / Footer Not showing

Hello,

So we are using a header and footer php file that are outside of the Wordpress them directory and are pulling from the root directory. This has been working great for about a year, though with the latest X update the header and footer are missing when viewing the website in the browser.

Below is the code we’ve been using in our x-child theme folder in file labeled “header.php”. Has there been a change, where this information needs to be placed in another location to work now?

Thank you for your help. We have been looking through past threads for a few days now and haven’t found a solution, so thought I’d open a thread.

    <?php

    // =============================================================================
    // HEADER.PHP
    // -----------------------------------------------------------------------------
    // The site header.
    // =============================================================================

    ?>

    <?php x_get_view( 'header', 'base' ); ?>

    <?php include_once("/includes/header.php"); ?>

Hi There,

Thank you for writing in, try moving your custom header.php file from root of the child theme, to the root of your WP installation folder.

Cheers!

Just want to make sure I understand so it can be completed properly. When it is stated to move the custom header.php, which one is being referenced?

…the header.php file which resides in the child theme (which contains the code shown above)

OR

…the line of code for a header.php file <?php include_once("/includes/header.php"); ?> … which is referenced as an include within the header.php file?

Hi @RocktheHouse1876,

Sorry for the confusion, please don’t move it as header.php is theme’s tile and not a Wordpress file. What you may need to change is the path “/includes/header.php”. Example,

<?php include_once(getcwd().'/../../includes/header.php'); ?>

Maybe the issue is that, it doesn’t resolve to the relative path.

Thanks!

Just made the update mentioned, and the header is not visible still.

By chance, would there be another route to the solution?

What is strange is the previous code (the code I posted at beginning of this thread) worked perfect for a couple years, until just recently. I’m perplexed, as the website has been static with no changes for a very long time, so not sure what could of happened.

Hi @RocktheHouse1876

I’ve checked your server and I can see it’s running on Windows server now, not linux, so these lines should be as following:

<?php include_once(getcwd().'\includes\header.php'); ?>

<?php include_once(getcwd().'\includes\footer.php'); ?>

I’ve changed them for you for now and you can see the header and footer are working fine, it could be that your web host changed your server from linux server to Windows server? I’m not sure.

Thanks.

WOW… thank you! Amazing work…

I will be contacting the web host to see why we were switched to a windows server without us knowing!

You’re most welcome! Yes, and Windows behave differently especially when it comes to path. Thanks!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.