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 WordPress Theme Development Working with CSS and JS in WordPress Themes Adding CSS to a Theme Via the functions.php File

Diamond Alexander
Diamond Alexander
1,313 Points

Getting a parse error for my functions.php

Hi y'all. I'll copy my code here but I can't figure out what I typed wrong. I'm definitely very new at php but I can't get the header/footer to show on my page because of an error on line 3. Is this something to do with PHP versions or did I mistype something?

Thank you! Diamond

<? php

function wpt_theme_styles () {

wp_enqueue_style ( 'foundation_css', get_template_directory_uri() . '/css/foundations.css' );
wp_enqueue_style ( 'normalize_css', get_template_directory_uri() . '/css/normalize.css' );
wp_enqueue_style ( 'normalize_css', 'http://fonts.googleapis.com/css?family=Asap:400,700,400italic,700italic);');
wp_enqueue_style ( 'main_css', get_template_directory_uri() . '/style.css' );

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

function wpt_theme_js() {

wp_enqueue_script( 'modernizr_js', get_template_directory_uri() . '/js/modernizr.js', ' ', '', false );
wp_enqueue_script( 'foundation_js', get_template_directory_uri() . '/js/foundation.js', ' array('jquery')', '', true );
wp_enqueue_script( 'main_js', get_template_directory_uri() . '/js/app.js', ' array('jquery', foundation_js'), '', true );

} add_action( 'wp_enqueue_scripts', 'wpt_theme_js' )

?>

3 Answers

Andres Altuve
Andres Altuve
16,274 Points

Hi Diamond,

Check the following line

wp_enqueue_style ( 'normalize_css', 'http://fonts.googleapis.com/css?family=Asap:400,700,400italic,700italic);');

Change it to:

wp_enqueue_style ( 'normalize_css', 'http://fonts.googleapis.com/css?family=Asap:400,700,400italic,700italic' );
Diamond Alexander
Diamond Alexander
1,313 Points

Hi Andres, Thank you for answering so quickly - I couldn't get it to work on my end, I tried to fix a spacing thing too between styles and a () but I keep getting the same error. I'm just going to go back and watch the video again and try to take it line by line lol

Let's see if that helps!

Andres Altuve
Andres Altuve
16,274 Points

Diamond,

I gave a second look to your code and you are using normalize_css twice, this is what you have:

wp_enqueue_style ( 'normalize_css', get_template_directory_uri() . '/css/normalize.css' );
wp_enqueue_style ( 'normalize_css', 'http://fonts.googleapis.com/css?family=Asap:400,700,400italic,700italic');

change it for:

wp_enqueue_style ( 'normalize_css', get_template_directory_uri() . '/css/normalize.css' );
wp_enqueue_style ( 'google_fonts', 'http://fonts.googleapis.com/css?family=Asap:400,700,400italic,700italic');

Hope this helps!

That's because the idiot doing the video just left it in there and didn't bother to correct it. Jesus Treehouse, are we paying for this level of incompetence or is it extra?