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 trialTim Gavin
549 PointsFunctions crashing site
Hi,
This isn't working, any thought?
<?php
// LOAD the THEME CSS
function theme_styles(){
wp_enqueue_style( 'normalize', get_template_directory_uri() . '/css/normalize.css' ); wp_enqueue_style( 'gird', get_template_directory_uri() . '/css/grid.css' ); wp_enqueue_style( 'main', get_template_directory_uri() . '/style.css' ); wp_enqueue_style( 'social', get_template_directory_uri() . '/css/webfonts/ss-social.css' );
wp_register_style( 'flexslider', get_template_directory_uri() . '/css/flexslider.css' ); if(is_page('home')) { wp_enqueue_style ('flexslider'); }
}
// LOAD JS - NOT WORKING!
function theme_js(){
wp_register_script('flexslider', get_template_directory_uri() . '/js/flexslider.js', array('jquery'), '', true);
if(is_page('home')) {
wp_enqueue_script ('flexslider');
}
wp_enqueue_script ('theme.js', get_template_directory_uri() . '/js/theme.js', array('jquery'), '', true););
} add_action('wp_enqueue_scripts', 'theme_js');
add_action('wp_enqueue_scripts', 'theme_styles');
// ENABLE CUSTOM MENUS add_theme_support( 'menus' );
?>
3 Answers
Andrew McCormick
17,730 Pointsyou have double ');' at then end of "the wp_enqueue_script ('theme.js'..." line
Tim Gavin
549 PointsThanks Andrew, must have looked at that one line of code for about 20 minutes without seeing that!
Andrew McCormick
17,730 Pointsno prob. happens to everyone.