Support » Themes and Templates » When I add <?php wp_head(); ?> To my header file in theme page doesn’t load

  • I recently downloaded a nice theme from

    However it appears there is a slight problem with the theme. I setup the Secure and Accessible PHP Contact Form for WordPress and anytime I do, it doesn’t seem like the CSS are actually being read. I contacted the developers of the form who told me that the header file in my new theme needed the <?php wp_head(); ?> code right above the </head> line. They even logged into my blog and added it for me. The problem is that whenever it’s added the only thing that loads on the page is the blue backround. Mike, one of the developers of the Contact form told me I need this in order for things like the bad behavior plugin etc.. to work.
    He said that the author should have never taken out the wp_head to begin with. I am running WordPress version 2.3.2

    Can anybody give me an idea where I can look to find why adding this code just kills the page? The theme is called DivGrad if anybody could maybe just download it and see what they get. Thanks Guys.

Viewing 15 replies - 1 through 15 (of 18 total)
  • Moderator Samuel Wood (Otto)

    (@otto42) Admin

    It would help more if we could see your actual site itself. Or the page with the problem, anyway. Post the URL of it.
    is the current blog

    of course I have commented out the <?php wp_head();?> code so that the page loads. If I uncomment all you will see is the blue gradient backround and nothing more.


    Moderator Samuel Wood (Otto)

    (@otto42) Admin

    Well, it’s hard to say what the exact problem is without actually seeing the problem. Put the wp_head() code back so we can see the problem in its native environment.

    I can tell you that your site doesn’t validate. You have some unclosed BR tags and this makes for some unmatched DIVs or something like that. That could cause what you’re seeing when the wp_head tag adds in the code that it’s trying to add in from your plugin.

    Validation, it’s not optional:

    Still, we can’t tell for sure where the issue is without seeing the problem in action.

    Ok. Thanks Otto. I just uncommented the code so it should be broken. I really like the look of the free theme from the first link so I am kind of bummed about the problem.
    I appreciate all the help. Maybe somebody who is better at WordPress code then me could download the theme and see something right away with it. Thanks guys.

    Moderator Samuel Wood (Otto)

    (@otto42) Admin

    Well, okay, now we see. That is indeed some kind of a problem.

    Normally, wp_head() does nothing at all. It’s a “hook” for plugins to be able to insert stuff into the page header. Looking at your page, I see that the code ends execution at that point. This indicates that whatever is hooking there has some kind of serious failure and exits out early.

    So first, I would try to disable this plugin you’ve added that requires wp_head(). Leave the wp_head() call there, but disable the plugin. See if your page reappears. I bet it will. If it does, the problem is not with the theme or with the wp_head call, but with the plugin.

    If it doesn’t come back, try disabling other plugins until it does. One of them must be the problem somehow.

    Ok. I will just disable every plugin right now on the site. 🙂 Fingers Crossed

    I just clicked the wordpress button to Deactivate All Plugins. I then re-loaded the page and still get just the blue gradient of a backround 🙁

    Do you see anything else now? If you have any time I would even be willing to just give you my login info.

    Moderator Samuel Wood (Otto)

    (@otto42) Admin

    No, I see the exact same thing.

    The only other thing I can think of is that you’re doing something horribly wrong in the theme’s header.php file. Post the contents of that file to and then post the link back here so we can have a look at it.

    In the meantime, go ahead and recomment out wp_head() to get the site to work.

    Ok. I submitted the code with the problematic line uncommented. I am going to re-comment the line on my website to get it back up and running. Thanks!

    Hope you see some big boo boo in the code so I can hopefully get the blog fully functional!

    Any luck with looking over the code? Let me know if you need me to post any of the code from any of the other template pages. Thanks

    Moderator Samuel Wood (Otto)

    (@otto42) Admin

    I cannot see your code. Your link is incorrect, it’s pastebin dot CA, not dot COM. Look at my link.

    Sorry about that. Just pasted it. The link is


    Moderator Samuel Wood (Otto)

    (@otto42) Admin

    The only thing I see that’s obviously wrong is this:
    <?=date('l d Y')?>

    Other than that, there’s nothing there that should cause it to break.

    Ok. Since I’m not an expert on template I don’t know why that is wrong either.

    Must be one of the other template files causing the site to go blank… I am going to contact you directly outside of the forum via email. Thanks!

    Hi Rhian, as Otto noted, wp_head() is a hook to allow plugins and whatnot to insert code into the head. The link to the form styles weren’t there because wp_head() wasn’t present to allow that. I would urge you to contact the maker of the theme as nobody else should be better qualified to help. It seems to me it’s definitely a theme problem since you’d isolated it by deactivating the plugins.

    By the way, if you want to fix that date function snippet, it should look like this:

    <?php echo date('l d Y'); ?>

    I would also encourage you to clear your error log, load the page so it goes blank, then check what’s in the error log. It may very well point to the corrupt file and code line.

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘When I add <?php wp_head(); ?> To my header file in theme page doesn’t load’ is closed to new replies.