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 trialammarkhan
Front End Web Development Techdegree Student 21,661 PointsBootstrap not loading
I tried following the author but my bootstrap isn't being loaded. it seem i am doing same excatly as author and my files are correctly placed under respective folder. Following is my code
function theme_js(){
global $wp_scripts;
wp_register_script( 'html5_shiv', 'https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js', '', '', false );
wp_register_script( 'respond_js', 'https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js', '', '', false );
$wp_scripts->add_data( 'html5_shiv', 'conditional', 'lt IE 9' );
$wp_scripts->add_data( 'respond_js', 'conditional', 'lt IE 9' );
wp_enqueue_script( 'bootstrap_js', get_template_directory_uri() . '/js/bootstrap.min.js', array('jquery'), '', true );
};
add_action('wp_enqueue_scripts','theme_js');
ammarkhan
Front End Web Development Techdegree Student 21,661 PointsLucas Santos That was a typo, i fixed it. But still not able to work. Is there anything mandatory that needs to be included for it to work?
Lucas Santos
19,315 PointsWhat Ludvík said, you need the wp_head();
function in the header.php and the wp_footer();
in the footer.php
1 Answer
Ludvík Matějíček
12,557 Pointsin header.php file you need add before end head tag wp_head function and in footer.php wp_footer function
ammarkhan
Front End Web Development Techdegree Student 21,661 PointsLudvík Matějíček After 2 days of trying everything, i finally got the problem. i was missing wp_footer();
Lucas Santos
19,315 PointsLucas Santos
19,315 PointsI don't see anything wrong in this code here unless it is something else. But I would remove that semicolon after the last curly brace ending the function. That's not needed.
and I also see a period after the semicolon in the add_action at the bottom. I don't know if that was by accident or not but if not remove it, that is wrong