0

I have a custom jquery file, here is code:

/* Custom JS */
jQuery(document).ready(function(){
    jQuery("#top-menu li:first-child a").addClass('selected');
});

And here my code to load js file in functions.php

add_action('wp_enqueue_scripts', 'load_custom_scripts');

function load_custom_scripts(){
    wp_enqueue_script('custom_script', THEMEROOT.'/js/custom.js', array('jquery'), true);
}

But when i check with firebug, my js not found. Hope anyone tell me what's wrong in my code?

enter image description here

1 Answer 1

0

Run following in your terminal:

chmod 0644 /path/to/your/theme/js/common.js

This command has to give your file proper rights and your web server will be able to read it.

3
  • i'm build on localhost
    – Hung PD
    Oct 1, 2013 at 8:48
  • Do you use Windows? You need to check your file permissions. Oct 1, 2013 at 8:49
  • i can use another wordpress theme, but when i'm building my own theme i get this problem?
    – Hung PD
    Oct 1, 2013 at 9:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.