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 Building a WordPress Theme with Foundation 5

issue 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");

?>

Edited to format code quote. Please refer to what I did for future quotes.

2 Answers

Yojance Rabelo
Yojance Rabelo
1,156 Points

Note 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
Teslim Adeyemo
21,275 Points

I guess you have to add the add action in a pair of curly brackets.