Site logo

Archived topic

Script in wp_head Hook makes a white space above page header in frontend

5 replies · Started by Hermann on April 19, 2017

Viewing posts 1–6 of 6

Hi,

I have added a Google Script into wp_head Hook. If I look in the frontend there suddenly is a white space above my page header. If I remove the script, the white space disappears and the layout is correct again. No matter if I use a child theme or not.

Here is the URL: http://wpland.heuser-webjobs.de

Can anybody help? Thank you very much.
Hermann

Hmm, seeing some broken HTML. You're sure you've added the code to the wp_head hook and not the Before Header hook?

Can you show me the code you're adding?

Hello Tom,

yes, I have added the code in wp_head. And I have installed another wordpress with the same confuíguration on another server. And the same problem occurs.

Here is the code:

<!-- Google Code for Remarketing Tag -->
<!--------------------------------------------------
Remarketing tags may not be associated with personally identifiable information or placed on pages related to sensitive categories. See more information and instructions on how to setup the tag on: http://google.com/ads/remarketingsetup
--------------------------------------------------->
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = xxxxxxxx;
var google_custom_params = window.google_tag_params;
var google_remarketing_only = true;
/* ]]> */
</script>
<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<div>
<img height="1" width="1" alt="" src="//googleads.g.doubleclick.net/pagead/viewthroughconversion/xxxxxxxx/?guid=ON&script=0" />
</div>
</noscript>

I believe it's the <img> tag in there inside the <noscript> tags. What happens if you remove everything between <noscript></noscript>?

Hi Tom,

I have removed the complete content between <noscript> and </noscript>. Now theres only the following code in wp_head hook, but there is no difference in frontend. Still the white space above the page.

Greets, Hermann

<!-- Google Code for Remarketing Tag -->
<!--------------------------------------------------
Remarketing tags may not be associated with personally identifiable information or placed on pages related to sensitive categories. See more information and instructions on how to setup the tag on: http://google.com/ads/remarketingsetup
--------------------------------------------------->
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = xxxxxxxxx;
var google_custom_params = window.google_tag_params;
var google_remarketing_only = true;
/* ]]> */
</script>
<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
</script>

Have you removed the code completely? I'm not seeing any gap anymore.

This archived topic is closed to new replies.