Archived topic
Function file and header.php changes after update
5 replies · Started by Anton on February 1, 2019
Hello guys!
I just updated Generatepress and realized that all my stuff in function.php and header.php disappeared.
In function.php I have the following code to get rid of the URL that gets created in buttons: https://docs.generatepress.com/article/generate_more_jump/
In header.php I have my Google analytics code.
Is there an easier way to do this? It gets quite time consuming adding everything back on every site. Hopefully there is a better way of doing it without having to use a bunch of plugins.
Thanks in advance and hat off for a great theme!
Hi there,
you should use a Child Theme for adding functions, as these will not be overwritten on theme update. Alternatively the Code Snippets Plugin. This article covers:
https://docs.generatepress.com/article/adding-php/
For GA Codes and other stuff you need to add the WP_Head you can use the Hook Element:
https://docs.generatepress.com/article/hooks-element-overview/
Hi David,
Thank you for your reply.
I am using a child theme, the "Marketer" one. But my function and header got over-written anyway. Or isn't Marketer a child theme?
No, the Library Sites such as marketer just import GP Settings etc. not a child theme.
Affirmative.
Thanks a lot for the help, David.
Have a good weekend!
Best regards,
Anton
You're welcome. Have a good weekend too!