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 trialernestinembak
272 PointsJS not loading
what am I doing wrong?
function imk_scripts() { wp_enqueue_script( 'bootstrap_js', get_template_directory_uri() . '/js/bootstrap.min.js', array('jquery'), '3.3.5', true ); wp_enqueue_script( 'plugin_js', get_template_directory_uri() . '/js/plugins.js', array(''), '1.0', true ); wp_enqueue_script( 'bskit_js', get_template_directory_uri() . '/js/bskit-scripts.js', array(''), '1.0', true ); }
add_action( 'wp_enqueue_scripts', 'imk_scripts' );
ernestinembak
272 PointsHere the mistake : there were no script dependencies, so I had to declare empty array: array(), rather than array('').
The correct code is:
function imk_scripts() { wp_enqueue_script( 'bootstrap_js', get_template_directory_uri() . '/js/bootstrap.min.js', array('jquery'), '3.3.5', true ); wp_enqueue_script( 'plugin_js', get_template_directory_uri() . '/js/plugins.js', array(), '1.0', true ); wp_enqueue_script( 'bskit_js', get_template_directory_uri() . '/js/bskit-scripts.js', array(), '1.0', true ); } add_action( 'wp_enqueue_scripts', 'imk_scripts'
Michael Peterman
19,087 PointsMichael Peterman
19,087 PointsHey man, that a little weird. I compared your code with what I usually use and it looks like it should be working. Are you getting any errors in the console (if you right click and go to Inspect Element > Console ) - any 404s?