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 trialJeffrey Beauchamps
8,437 PointsHelp fix a WordPress Parse error
Can someone please help me with this error
Parse error: syntax error, unexpected '.' in C:\wamp\public_html/wp-content/themes/treehouse-prtfolio/functions.php on line 16
2 Answers
Austin Whipple
29,725 PointsSo it looks like you need to double check your final wp_enqueue_script() line. I think you're missing a parenthesis to close your dependency array before closing wp_enqueue_script arguments.
Try:
wp_enqueue_script( 'main_js', get_template_directory_uri() . '/js/app.js' , array('jquery', 'foundation_js'), '', true);
Austin Whipple
29,725 PointsJeffrey,
Looks like a simple typo in your code somewhere. Possibly just a period (.) that shouldn't be there, or an earlier error on the same line where, say, an echo statement isn't properly concatenating something. The error reports the error on line 16. If you can't see an issue on that line, try a line or two earlier.
For additional help, it would be good to include a copy of your code in your question. Check out the Markdown Cheatsheet below the editor for help formatting the code.
Jeffrey Beauchamps
8,437 PointsI'm sorry it's not unexpected '.' but unexpected ';' and this is my code below.
<?php
function wpt_theme_styles() {
wp_enqueue_style( 'foundation_css', get_template_directory_uri() . '/css/foundation.css');
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');
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');
?>
```
Jeffrey Beauchamps
8,437 PointsJeffrey Beauchamps
8,437 PointsIt works now, Thank you so much Austin. You save me from a lot of frustration.