Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #391875

    Hi there,

    I’ve setup a child theme for enfold which is working fine.

    I need to add Google Tag manager to the site and the recommended method is to add the code into header.php

    My standard child theme setup doesn’t have a header.php

    My question are:

    1.
    Can I simply create a header.php file in the child theme folder?

    2.
    If so, what standard code do I need to place in the file?

    Thanks in advance.

    Kevin

    #391926

    Hi kashcroft!

    You can simply copy header.php from your Enfold folder into your child theme folder. I’m not 100% sure about where to add the Google Tag Manager code though but I think it goes into the head tag.

    Regards,
    Rikard

    #528572

    Hi Rikard,
    I have done your suggestion – simply copy header.php from your Enfold folder into your child theme folder – but when I check the source code it is still using the parent theme header instead of child theme.

    Any ideas? Thanks.

    #528956

    Hey!

    Did you activate the child theme? Please post the login details here so that we can check it.

    Cheers!
    Ismael

    #532434

    Hi Ismael,
    Yes the child theme is activated. I have tried disabling plugins and cache plugins but no change.

    Strangely the child theme works fine for css and function.php files, but not for any theme layout files such as header.php.

    I have added the login info below. It would be great if you could have a look. Thanks.

    #533025

    Hey!

    It is using the child theme’s header.php file. I modified the code a bit to test it:

    <?php echo "Test"; do_action('ava_after_main_container'); ?>
    

    You can see the “Test” text at the very top of the site. Original code is:

    <?php do_action('ava_after_main_container'); ?>
    

    Cheers!
    Ismael

    #533103

    Thank you! Not sure why it didn’t seem to work for me but it is indeed working now – cheers.

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘header.php in child theme’ is closed to new replies.