Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress WordPress Theme Development WordPress Header and Footer Templates Porting existing headers and footers into WordPress

Eric Tirado
seal-mask
.a{fill-rule:evenodd;}techdegree
Eric Tirado
iOS Development Techdegree Student 7,036 Points

Blank Local page as soon as I place <?php wp_head(); ?> before the closing </head> tag. I remove it and it works again.

I am using the work files, and following the video step by step. anything wrong with this header.php content? error happens as I'm following around minute 2:40 in the video Porting existing headers and footers into WordPress

<html class="no-js" lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title><?php wp_title(); ?></title>

    <?php wp_head(); ?>
  </head>

  <body>
    <header class="row no-max pad main">
  <h1><a class='current' href="<?php bloginfo('url'); ?>"><?php bloginfo('name'); ?></a></h1>
  <a href="" class="nav-toggle"><span></span>Menu</a>
  <nav>
    <h1 class="open"><a class='current' href="index.html">G</a></h1>
    <ul class="no-bullet">
      <li class="current parent"><a class='current' href="index.html">Portfolio</a>
        <ul class="sub-menu">
          <li><a href="item.html">Portfolio Item</a></li>
          <li><a href="item.html">Portfolio Item</a></li>
          <li><a href="item.html">Portfolio Item</a></li>
          <li><a href="item.html">Portfolio Item</a></li>
        </ul>
      </li>
      <li class="parent"><a href="blog.html">Blog</a>
        <ul class="sub-menu">
          <li><a href="single-post.html">Single Post</a></li>
          <li><a href="author.html">Author Page</a></li>
        </ul>
      </li>
      <li><a href="about.html">About</a></li>
      <li><a href="contact.html">Contact</a></li>
    </ul>
  </nav>
</header>

Hi Eric,

I can't see anything that stands out from that but the problem may be in another file.

If you're in a development environment, one quick test would be to enable WP DEBUG in your wp-config.php (details of how are in the link).

It should write out any errors to the screen. Please make sure you disable it again straight after though as you don't want errors showing in a production environment. :)

-Rich

Eric Tirado
seal-mask
.a{fill-rule:evenodd;}techdegree
Eric Tirado
iOS Development Techdegree Student 7,036 Points

I'm really new to WP. All I have set up is the MAMP local server. I went to the wp-config.php and set WP_DEBUG to true, but where do I see the log?

Hi Eric,

When you add the following back in you should see an error instead of a blank screen:

<?php wp_head(); ?>

-Rich

1 Answer

Hey Eric,

From past experience, my bet is that there's a problem in your functions.php file in the section that you enqueue your scripts and styles (one of the things that wp_head is calling). Maybe it's a missing semi-colon, or bracket, or comma, or something is commented out.

As Rich stated above I don't see anything wrong with code you posted. Looking at the project files, I don't see any issue with the function.php file either but perhaps you've modified that to call a new stylesheet or js file? Your debug error should be able to confirm the above or point you in the correct direction.

Rob