[Resolved] Create header file in the child theme

Home Forums Support [Resolved] Create header file in the child theme

Home Forums Support Create header file in the child theme

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1589669
    Nicola

    Hello πŸ™‚

    I have installed GP Premium and the child theme: to install Google Tag Manager I will have to insert the tag in the header file, but it is absent in the child theme.

    To create it, can I copy and paste the header file from the parent theme or do I need to make some other changes?

    Thank you for your help in this matter! πŸ™‚

    #1589992
    Leo
    Staff
    Customer Support

    Hi there,

    You don’t actually need a child theme to install GOogle Tag Manager.

    Simply create a hook element using wp_head hook should do:
    https://docs.generatepress.com/article/hooks-element-overview/
    https://docs.generatepress.com/article/wp-head/

    Let me know if this helps πŸ™‚

    #1590867
    Nicola

    Hi πŸ™‚

    Thank you for your reply, I also found the guide that explains it πŸ™‚ I have installed the child theme only to install Google Tag Manager so is it necessary that I leave the child theme activated or can I use the parent theme?

    Thank you πŸ™‚

    #1590879
    David
    Staff
    Customer Support

    Hi there,

    if you have added the GTM to your Child Theme then you must keep it enabled.

    #1590951
    Nicola

    Hi,

    Thank you very much πŸ™‚ If I install the GTM in the parent theme, and I don’t need any other changes, is it useful that I continue to use the child theme or can I disable it?

    I’m sorry for the questions and thanks for your help πŸ™‚

    #1591034
    David
    Staff
    Customer Support

    You should never edit the parent theme files.
    If you want to add it without a child theme then following this article:

    https://docs.generatepress.com/article/implement-google-tag-manager/

    #1591067
    Nicola

    Ok, I have the last question: I previously added the GTM tag following that guide but with the child theme active. Following that guide, does the theme have to be parent or child?

    Thank you for your help and I’m sorry because I’m not expert πŸ™‚

    #1591182
    David
    Staff
    Customer Support

    If you used the Function method ie. this:

    https://docs.generatepress.com/article/implement-google-tag-manager/#using-functions

    Then those files are added to your Child Theme. And Yes you must keep the Child Theme Active.

    #1591248
    Nicola

    Thank you πŸ™‚ And if I use the hook method do I have to keep the child theme active or is it not necessary? I installed the child theme only to add the GTM tag, in case that I don’t need the child theme to use the hook method and I don’t have to make other changes, would it be necessary to keep the child theme active?

    Thank you! πŸ™‚

    #1591268
    Leo
    Staff
    Customer Support

    And if I use the hook method do I have to keep the child theme active or is it not necessary?

    No – you don’t need a child theme in this case πŸ™‚

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.