hi,
i would like to add google ad manager tags with custom php (that echo page id and tags) within a header template AFTER the doctype is declared, but the “Google Analytics and JavaScript Codes” section doesn’t seem to work inside the loop.
could you please advise how i can add? via template? via child header?
thanks!
any tips?
-
This topic was modified 4 years by
stephenetta.
Hi,
Normally, by setting the code in the theme panel should do the job -> https://i.imgur.com/jrthHDD.png in case that this is not working, then you need to set it in the theme files, for this please use our guide from here https://forum.tagdiv.com/topic/how-can-i-get-theme-header-section/
Also setting file in a child theme are usually working only if are from standard pack, but this file I think that can work from composer -https://forum.tagdiv.com/the-child-theme-support-tutorial/
Thank you!
hi thanks for your response but it ignores my original question and notes.
“Google Analytics and JavaScript Codes” section in theme panel does not parse PHP within the WordPress loop. in addition, i need to have the code called AFTER the doctype is declared. i already have a child theme, but even when adding code to header.php it calls BEFORE doctype.
so, my question is it possible to add via cloud template? or is there a trick to inject code in child header to render after the doctype is defined
Hi,
So, this is a php code that need to be set in a special place, then I do not think that will work setting it with tagDiv Composer, for the moment there are no elements to support php code, some of theme support html, css and a some JavaScript.
Now, if will be to set the code in the theme header.php file, I think that will be triger this file wp-content/plugins/td-composer/legacy/Newspaper/header.php (our theme has 3 header.php files, but if the tagDiv Standard Pack is not installed and you use a cloud header, the above one will be use). Just copy the file from there in child theme (Newspaper-child/header.php) and set the code in that file, it should work properly.
I hope this will help!
Thank you!
hey thanks
i did that previously before reaching out.
the problem with that is the code is called BEFORE the doctype. i want it to show right before the closing </head> div.
re: PHP, is there any way to inject PHP code into templates?
Hello @stephenetta!
You can insert PHP only in the files, in your case in the file that my colleague provided to you.
Thank you!