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 trialBrad Griffin
7,003 PointsHow is this file name and path incorrect?
Just look at the error that it keeps spitting out for a second (b/c I know there might be other mistakes).
Am I wrong here? That is the correct filepath and name, right? What am I missing?
<?php
function my_plugin_frontend_scripts(){
wp_enqueue_style( 'my_plugin_frontend_css', plugins_url( 'my-plugin/css/front-end.css' ) );
wp_enqueue_script( 'my_plugin_frontend_js', plugins_url( 'js/front-end.js' ), array('jquery'), '', true );
}
?>
1 Answer
Chris Shaw
26,676 PointsHi Brad,
This one is a bit tricky as it's expecting you to use the same path structure as the CSS file which is how the plugins_url
function works as it bases the path from /home/user/wp-content/plugins/
thus requiring you to including my-plugin
as part of the string.
my-plugin/js/front-end.js
Aside from that your code was perfect