• Resolved mirshafie

    (@mirshafie)


    Hello folks. I have suddenly noticed a strange problem with a theme that I’m developing.

    The background image for the theme is supposed to be positioned at the top of the page, but there is a gap of about 25 px from the top of page to where the background image starts. (Background color begins at the top.)

    I’ve tried removing everything else from my theme code and stylesheet, and have come to the conclusion that there’s something off with wp_head. As soon as I remove the call for wp_head in header.php, the gap to the background image disappears.

    Now, my theme is very simple and for a specific purpose, so I don’t think that I really need wp_head. But I would still like to know what is causing the problem, so I don’t go on making shaky themes.

    Any input would be greatly appreciated.

Viewing 4 replies - 1 through 4 (of 4 total)
  • but there is a gap of about 25 px from the top of page to where the background image starts.

    I think you’ll find it’s 28px and that it’s due to the Admin bar.

    Do I really need wp_head in my header?

    Absolutely! It’s required by WordPress itself and many plugins.

    Thread Starter mirshafie

    (@mirshafie)

    I think you’ll find it’s 28px and that it’s due to the Admin bar.

    I think you’re right. Logging out closes the gap. I hadn’t really reflected on the fact that the Admin bar was gone.

    Any idea why the content of the Admin bar doesn’t show up?

    Does your theme have a call to <?php wp_footer();?> in footer.php

    Thread Starter mirshafie

    (@mirshafie)

    No, and it turned out to be the problem. This was the first theme I built from scratch and I had not realized how important the wp_footer call was.

    My theme works now.

    Thanks for patiently answering this issue again, esmi.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Unwanted margin resulting from wp_head’ is closed to new replies.