Archived topic
Header.php missing after 3.2.1 update. Lost popup and GA analytics script.
13 replies · Started by ventureupwards on October 31, 2022
Hello,
After the 3.2.1 update, I lost access to the child theme header.php via SFTP. I have lost google analytics and a popup for our newsletter which were located in the header.php file.
Can you please help - Thank you!
John Culotta
Hi John,
Hmm I'm not sure how that is possible - a child theme cannot be updated/changed during a parent theme update and we have not had any other reports on this.
A couple of options here:
1. Restore a backup before the theme update and make sure the code is placed correctly in the child theme.
2. Re-add the code and make sure it's added using a child theme or a hook element.
Hi Leo - I agree, this is odd. I did try to restore with an older backup and still no header.php access in the child theme.
Hi Leo - is there a way to add back my Google Analytics script and Newsletter popup form? Thanks!
I didn't want to add one more thing, but I also lost a blue button that was in the header on mobile. It's on the desktop, but not mobile. WebDesignDev.com is the site we've been discussing.
I did try to restore with an older backup and still no header.php access in the child theme.
Do you mean there isn't a header.php file in the child theme? Then I'm guessing that it never existed - not sure how it could disappear otherwise.
is there a way to add back my Google Analytics script and Newsletter popup form? Thanks!
I provided 2 options above:
https://generatepress.com/forums/topic/header-php-missing-after-3-2-1-update-lost-popup-and-ga-analytics-script/#post-2395806
If #1 didn't work then you will need to do #2.
I'll try it. Note that the header.php did exist because that's where my Google analytics script, a popup, and popunder scripts were placed and worked fine before the update. Thanks.
because that’s where my Google analytics script, a popup, and popunder scripts were placed and worked fine before the update.
The only reason I can think of is that they were added in the header.php of the parent theme and not the child theme.
Hello Leo,
I hope you are not assuming that I'm making this up or exaggerating. Again, there is no header.php file with the child theme. I had these important scripts in there and they worked fine. Now they are gone.
Can you please give me some direction or refer me to a developer?
Thank you,
John
if there is a way to provide screenshots, please advise.
Regarding your 2 suggestions:
1. Restore a backup before the theme update and make sure the code is placed correctly in the child theme.
ALREADY TRIED THIS PRIOR TO OUR CONVERSATION AND NO GO. STILL THE SAME.
2. Re-add the code and make sure it’s added using a child theme or a hook element.
CAN NOT RE-ADD CODE, BECAUSE CHILD THEME STILL MISSING HEADER.PHP. I DON'T KNOW HOW TO "HOOK ELEMENT" AS YOU'VE SUGGESTED. I'M NOT A DEVELOPER AND NOT THAT SAVVY AT THIS.
ALREADY TRIED THIS PRIOR TO OUR CONVERSATION AND NO GO. STILL THE SAME.
Does the GA analytics and the Newsletter popup form work when the backup was restored? If so that means the code is being added somewhere else.
CAN NOT RE-ADD CODE, BECAUSE CHILD THEME STILL MISSING HEADER.PHP.
Sounds like there is a bit of misunderstanding here.
By default, the child theme does not have the header.php file included. It is up to you to copy the file and paste it into the child theme folder when needed:
https://github.com/tomusborne/generatepress/blob/master/header.php
Does that make more sense?
No, when i did a backup restore, the GA analytics script and newsletter form did not come back. My GA analytics have been showing "0" traffic since this happened and we normally have 40k a month.
I appreciate you making a suggestion with the link below, but I have no idea what to do with this info:
https://github.com/tomusborne/generatepress/blob/master/header.php
Question: Can i just add a plugin where I can add these important scripts (back in) to the child theme header?
Thanks,
Question: Can i just add a plugin where I can add these important scripts (back in) to the child theme header?
No - the plugin method would be the same as using the hook element suggested.
If all of your scripts needs to be added in the <head> tag then you can just create a hook element for each script and use the wp_head hook:
https://docs.generatepress.com/article/hooks-element-overview/
https://docs.generatepress.com/article/wp-head/