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 trialImpact Media
18,030 Pointsissue with functions.php on Building a Wordpress Theme with Foundation 5
I am working through the above video and i have come across and issue which i cannot see :/ I have listed my code below can anyone spot the issue ?
Basically i have got to the 30min mark on the video and Zac has showed us how to link JQuery but mine is not coming up in my source.
Can someone please help :D
<?php
// Load foundation JS
function foundation_scripts() {
wp_deregister_script("jquery");
wp_register_script("jquery", "http://code.jquery.com/jquery-2.1.0.min.js", false, null);
wp_enqueue_script("jquery");
}
if (!is_admin()) add_action( "wp_enqueue_script", "foundation_scripts");
// Load Foundation CSS
function foundation_styles() {
wp_enqueue_style( "foundation", get_template_directory_uri() . "/css/foundation.css" );
wp_enqueue_style( "foundation_min", get_template_directory_uri() . "/css/foundation_min.css" );
wp_enqueue_style( "normalize", get_template_directory_uri() . "/css/normalize.css" );
wp_enqueue_style( "theme_css", get_template_directory_uri() . "/css/style.css" );
}
add_action("wp_enqueue_scripts", "foundation_styles");
?>
2 Answers
Yojance Rabelo
1,156 PointsNote that the function to add a script is wp_enqueue_script but the action name is wp_enqueue_scripts, you are missing the "s" on the action name. You got it right on the Styles section but not on the Scripts section.
Teslim Adeyemo
21,275 PointsI guess you have to add the add action in a pair of curly brackets.
Ted Sumner
Courses Plus Student 17,967 PointsTed Sumner
Courses Plus Student 17,967 PointsEdited to format code quote. Please refer to what I did for future quotes.