My _header.php file is missing from Global

Hi, I am trying to install Google tag manager on a clients account. I know that is needs to be added to /themes/x-child/framework/views/global

However, when I look in the X theme folder to copy the _header.php to the child theme, the file is simply not there.

Nothing took place prior to this happening. My clients SEO company contacted me today asking for the tag manager to be added, I went in, and there was nothing.

How do I remedy this and add the tag manger?

I’m experiencing the same problem. I assume there’s been some refactoring and a lot of the documentation hasn’t been updated. I just downloaded a brand new version and _header.php isn’t there. My renew directory also doesn’t have wp-header.php.

There’s a directory named “header” which contains base.php and masthead.php. I suspect these are the ones you need. I was able to add Google code to base.php and it works.

Hi There,

The file _header.php is moved on this \x\framework\legacy\cranium\headers\views\global directory, copy that same path to your child theme by creating the necessary folders.

Hope it helps,
Cheers!

Hi there,

I came here by a link in the following post that describes my problem exactly:

It’s about two years ago and still overwriting the template file framework/views/header/base.php with a copy from your child-theme (relatively in the same location), the site is broken. Even if it’s just a copy of the unmodified original template file. The body section starts with <div id=“x-root” class=“x-root”…

I guess it’s a kind of “relative path issue”.

When will this issue be solved? Actually I do not want to use templates from the “legacy” folder and furthermore I assume you want to get rid of legacy templates some day in future versions…?! Any news on this?

Thank you mucho :wink:
Chris

Hello Chris,

Based on the thread that you have linked, it looks like you are trying to add something in the head area of the site.

In that case, it is not necessary to touch the base.php file.

You can just make use of the wp_head hook do add your codes in that area of the site.

Please install and activate the child theme and login through FTP then edit the functions.php then add this code:


add_action('wp_head', 'add_header_code');
function add_header_code(){
?>
    <!— Add your codes here  —>
   
    <?php
};

In case you are trying to do something else, kindly let us know in more detail so that we can provide some more suggestions.

Hope this helps.