[Resolved] Header.php overwritten

Home Forums Support Header.php overwritten

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #941436
    Micha

    Hello,

    after the update of your theme my Header.php was overwritten.

    Which is very bad, because it contains the google tag manager.

    but because I found it right away, I was able to solve the problem.

    I hope it won’t happen with the next update.

    best regards

    Micha

    #941544
    David
    Staff
    Customer Support

    Hi there,

    you should never make changes to the parent theme function files as they will always be overwritten when the theme updates.

    If you need to make changes to a function or a template then you need to use a child theme.

    The easiest and safest way to add the GTM codes is to use the Hook Element:

    https://docs.generatepress.com/article/hooks-element-overview/

    Create a new hook. Add your first GTM code to its content. Select the WP_head Hook from the list. And set your display rules to Entire Site.

    Repeat this for the second code ( the one that is required within the Body) but use the before_header hook, and set priority 0.

    #941571
    Micha

    Hi David,

    thanks for the info. I’ll take a look and create a child theme.

    best regards

    Micha

    #941577
    David
    Staff
    Customer Support
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.