WordPress.org

Ready to get started?Download WordPress

Forums

When I add <?php wp_head(); ?> To my header file in theme page doesn't load (19 posts)

  1. rhianblock
    Member
    Posted 6 years ago #

    I recently downloaded a nice theme from http://www.romow.com/blog/wordpress-theme-divgrad/

    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.

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

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

  3. rhianblock
    Member
    Posted 6 years ago #

    http://www.rhianblock.com/blog
    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.

    Thanks!

  4. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    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:
    http://validator.w3.org/check?uri=http%3A%2F%2Fwww.rhianblock.com%2Fblog%2F&charset=%28detect+automatically%29&doctype=Inline&group=0

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

  5. rhianblock
    Member
    Posted 6 years ago #

    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.

  6. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    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.

  7. rhianblock
    Member
    Posted 6 years ago #

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

  8. rhianblock
    Member
    Posted 6 years ago #

    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.

  9. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    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 http://wordpress.pastebin.ca 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.

  10. rhianblock
    Member
    Posted 6 years ago #

    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!

    http://wordpress.pastebin.com/f36aa8cf9

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

  11. rhianblock
    Member
    Posted 6 years ago #

    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

  12. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

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

  13. rhianblock
    Member
    Posted 6 years ago #

    Sorry about that. Just pasted it. The link is
    http://wordpress.pastebin.ca/841232

    Thanks

  14. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    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.

  15. rhianblock
    Member
    Posted 6 years ago #

    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!

  16. MikeCherim
    Member
    Posted 6 years ago #

    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.

  17. rhianblock
    Member
    Posted 6 years ago #

    Ok. I found this error when I enabled display_errors in my php.ini

    <b>Fatal error</b>: Call to undefined function check_header() in <b>D:\HostingSpaces\rhianblock\RhianBlock.com\wwwroot\blog\wp-content\themes\divgrad-10\functions.php</b> on line <b>36</b>

    Line 36 is the 3rd line right below and the one that starts with the $output check_header () code in it

    function kubrick_head() {
    $head = "<style type='text/css'>\n<!--";
    $output = ''; check_header();
    if ( kubrick_header_image() ) {
    $url = kubrick_header_image_url() ;
    $output .= "#header { background: url('$url') no-repeat bottom center; }\n";
    }
    if ( false !== ( $color = kubrick_header_color() ) ) {
    $output .= "#headerimg h1 a, #headerimg h1 a:visited, #headerimg .description { color: $color; }\n";
    }
    if ( false !== ( $display = kubrick_header_display() ) ) {
    $output .= "#headerimg { display: $display }\n";
    }
    $foot = "--></style>\n";
    if ( '' != $output )
    echo $head . $output . $foot;
    }

    add_action('wp_head', 'kubrick_head');

    function kubrick_header_image() {
    return apply_filters('kubrick_header_image', get_settings('kubrick_header_image'));
    }

  18. rhianblock
    Member
    Posted 6 years ago #

    I commented out that line and everything is working now!

    Should I be worried about having to comment this line out? What does it do or is it written improperly?

    Thanks again guys

  19. MikeCherim
    Member
    Posted 6 years ago #

    Hi Rhian. That shouldn't be a problem that I'm aware of. It seems to be checking for that default Kubrick theme header stuff, but I don't know why the function would be undefined.

    But, glad it's working :)

Topic Closed

This topic has been closed to new replies.

About this Topic