Hi there
i want to add Add script immediately after the opening tag
where can i find the original and copy it to my child-theme ?
Kind regards.
Hi there
i want to add Add script immediately after the opening tag
where can i find the original and copy it to my child-theme ?
Kind regards.
Hi there,
Thanks for writing in! Please add the following code in your child theme’s functions.php file:
// Add custom code after body tag
function my_custom_code() {
// Add your custom code here
}
add_action('x_before_site_begin', 'my_custom_code');
Hope this helps!
Hi there
When I try the above method I get "syntax error, unexpected ‘<’ ". If I save my changes anyway, I get white screen of death.
I am trying to specifically add the Google Tag Manager snippet that needs to be added directly after the tag on every page. I was redirected to this thread from here.
The snippet looks like this:
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXX"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
Hi there,
Please try:
// Add custom code after body tag
function my_custom_code() {
?>
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXX"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
<?php
}
add_action('x_before_site_begin', 'my_custom_code');
Hope this helps.
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.