Local WordPress site receiving error when I add wp_head(); and wp_footer();

I’m working on a local WordPress site and when I add the wp_head(); and wp_footer(); functions into my index.php file the site receives a “Unable to load the webpage because the server sent no data” message. I have all the required WordPress files in my htdocs and I’m using MAMP. When I delete the wp_head(); and wp_footer(); functions the site shows back up. What is causing this?

<!DOCTYPE html>
<html>
  <head>
    <title><?php bloginfo('name'); ?></title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <?php wp_head();?>
  </head>
  <body>
    <a class="btn" href="#">hello</a>

    <?php wp_footer()
  </body>
</html>

/**
 * Load CSS and Javascript
 */

function load_styles_and_scripts(){

    //load styles
    wp_enqueue_style(
            'bootstrap-styles',
            get_template_directory_uri() . '/css/bootstrap.min.css'
        );
    wp_enqueue_style(
            'main-styles',
            get_template_directory_uri() . '/style.css'
        );

    //load scripts
    wp_enqueue_scripts(
            'jquery',
            'http://code.jquery.com/jquery.min.js'
        );

    wp_enqueue_scripts(
            'bootstrap-scripts',
            get_template_directory_uri() . '/js/bootstrap.min.js'
        );


}

add_action('wp_enqueue_scripts', 'load_styles_and_scripts');

Related posts

Leave a Reply

1 comment