Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

WordPress From Bootstrap to WordPress Setup a Bootstrap Theme Add Bootstrap JS via the functions.php File

S Ananda
S Ananda
9,474 Points

Jumbotron appears to have updates that aren't addressed in the video.

My header and footer files from Jumbotron have additional code in them that are not addressed in the video, obviously due to an update. I don't know what to do with the code.

`` <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- The above 3 meta tags must come first in the head; any other head content must come after these tags --> <meta name="description" content=""> <meta name="author" content=""> <link rel="icon" href="../../favicon.ico">

<title>From Bootstrap to WordPress Tutorial</title>

   <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<link href="../../assets/css/ie10-viewport-bug-workaround.css" rel="stylesheet">

<script src="../../assets/js/ie-emulation-modes-warning.js"></script>

<?php wp_head(); ?>

</head> `` The line about IE10 viewport with the link, as well as the next link are not in the video. Also in the footer:

`` <!-- Bootstrap core JavaScript ================================================== --> <!-- Placed at the end of the document so the pages load faster --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> <script>window.jQuery || document.write('<script src="../../assets/js/vendor/jquery.min.js"><\/script>')</script> <script src="../../dist/js/bootstrap.min.js"></script> <!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> <script src="../../assets/js/ie10-viewport-bug-workaround.js"></script>

<?php wp_footer(); ?>

</body> </html>``

the window.jquery script and the IE 10 script are not in the original video.

I don't know if I need to do anything with them. My site worked through adding the shiv and respond scripts, but when I added in the enqueue for js my site totally broke. Nothing showing on the page. The only thing I can figure out is that I need to deal with the lines of code not showing in the video. I get a 500 error code.

2 Answers

Martin Jones
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Martin Jones
Front End Web Development Techdegree Graduate 42,600 Points

Hi,

The IE10 scripts will likey be a bug fix for version 10 of the Internet Explorer browser, so it would be up to you if you include them.

White screens are pretty common in WordPress when something is slightly out in the functions.php file, please can you paste the code for your functions file.

S Ananda
S Ananda
9,474 Points

Geez, I should have included it in my original post, sorry.

<?php

function theme_styles() {

    wp_enqueue_style( 'bootstrap_css', get_template_directory_uri() . '/css/bootstrap.min.css' );
    wp_enqueue_style( 'main_css', get_template_directory_uri() . '/style.css' );

}

add_action( 'wp_enqueue_scripts', 'theme_styles' );

function theme_js() {

    global $wp_scripts;

    wp_register_script( 'html5_shiv', 'https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js', '', '', false );
    wp_register_script( 'respond_js', 'https://oss.maxcdn.com/respond/1.4.2/respond.min.js', '', '', false );

    $wp_scripts->add_data( 'html5_shiv', 'conditional', 'lt IE9' );
    $wp_scripts->add_data( 'respond_js', 'conditional', 'lt IE9' );

    wp_enqueue-script( 'bootstrap_js', get_template_directory_uri() . '/js/bootstrap.min.js', array('jquery'), '', true );


}
add_action( 'wp_enqueue_scripts', 'theme_js');


  ?>