this is the directoryI am trying to integrate an animation in my Wordpress home page, for this I am trying to load scripts from "skrollr" library, but my styles and scripts don't load.

this is the code I added is function.php in the child theme:

function add_scripts() {
   wp_enqueue_style( 'main', get_stylesheet_directory_uri() . '/images/main.css' );
   wp_enqueue_script( 'skrollr', get_template_directory_uri() . '/js/skrollr.min.js', '', '', false);
add_action ('wp_enqueue_scripts', 'add_scripts');

and these are the errors that I get from the console: enter image description here

  • 1
    replace get_template_directory_uri() with get_stylesheet_directory_uri() and add '/' before 'main.css' Aug 21, 2017 at 11:18
  • thanks for your reply but still have these errors:
    – jane
    Aug 21, 2017 at 11:26
  • can you post an image of your theme directory or can you show me via teamviewer? I want to help you to resolve this issue. Aug 21, 2017 at 11:30
  • Yes sure I can share it with you via teamviewer
    – jane
    Aug 21, 2017 at 12:27
  • knock me here [email protected] when you available to share teamviewer Aug 22, 2017 at 15:25

2 Answers 2


You are using a child theme here, it means that you should use get_stylesheet_directory_uri() to get the child theme's directory.

So, in your case, get_stylesheet_directory_uri() will return:


and get_template_directory_uri() will return:


Use this to build your paths. Also, pay attention that you need to include a forward slash before your style/script's name, since these functions do not provide a trailing slash:

wp_enqueue_style( 'main', get_template_directory_uri() . '/main.css' );

Which will return:

  • Thanks for your reply, I corrected it but the errors still remain
    – jane
    Aug 21, 2017 at 13:07
  • Then I doubt the problem is with your functions, if you have build the proper paths and it's still not working.
    – Johansson
    Aug 21, 2017 at 13:08

This should work

function add_scripts() {
   wp_enqueue_style( 'main', get_stylesheet_directory_uri() . '/css/images/main.css' );
   wp_enqueue_script( 'skrollr', get_stylesheet_directory_uri() . '/js/skrollr.min.js', '', '', false);
add_action ('wp_enqueue_scripts', 'add_scripts');

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.