Title: Problem with get_stylesheet_directory using child theme
Last modified: August 21, 2016

---

# Problem with get_stylesheet_directory using child theme

 *  [codeguerilla](https://wordpress.org/support/users/codeguerilla/)
 * (@codeguerilla)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/problem-with-get_stylesheet_directory-using-child-theme/)
 * Hello. I have run in to an issue loading scripts and styles using get_stylesheet_directory().
 * I am making a child theme so calls to get_template_directory_uri() are returning
   the parent theme, Now when trying to get_stylesheet_directory() I am getting 
   paths that look like this:
 * [http://localhost/clients/myclientC:xampphtdocsclientsmyclient/wp-content/themes/twentyfourteen-child/css/custom-styles.css](http://localhost/clients/myclientC:xampphtdocsclientsmyclient/wp-content/themes/twentyfourteen-child/css/custom-styles.css)
 * If someone has any idea whats happening I would be very grateful.
 * Cheers

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Moderator [Jose Castaneda](https://wordpress.org/support/users/jcastaneda/)
 * (@jcastaneda)
 * THEME COFFEE MONKEY
 * [12 years, 2 months ago](https://wordpress.org/support/topic/problem-with-get_stylesheet_directory-using-child-theme/#post-4804730)
 * What is the code you are using?
 *  Thread Starter [codeguerilla](https://wordpress.org/support/users/codeguerilla/)
 * (@codeguerilla)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/problem-with-get_stylesheet_directory-using-child-theme/#post-4804732)
 *     ```
       function add_required_scripts() {
          // register your script location and dependencies
          wp_register_script('customscripts', '/get_stylesheet_directory() . /js/bootstrap.min.js', array('jquery'));
          wp_register_script('flexslider',  '/get_stylesheet_directory() . /jquery.flexslider-min.js', array('jquery'), '2.1');
          // enqueue the script
          wp_enqueue_script('customscripts');
          wp_enqueue_script('flexslider');
       }
       add_action('wp_enqueue_scripts', 'add_required_scripts');
       ```
   
 * Pretty much the same for the stylesheets just using wp_enque_style()
 * For the sake of getting things done I currently replaced the calls to get_stylesheet_directory()
   with the actual path, ie: [http://localhost/clients/myclient/js/flexslider.js](http://localhost/clients/myclient/js/flexslider.js)
   which loads the scripts and has allowed me to keep working but obviously this
   is not the best solution.
 * thanks
 *  Moderator [Jose Castaneda](https://wordpress.org/support/users/jcastaneda/)
 * (@jcastaneda)
 * THEME COFFEE MONKEY
 * [12 years, 2 months ago](https://wordpress.org/support/topic/problem-with-get_stylesheet_directory-using-child-theme/#post-4804733)
 * Get rid of the quote and slash before the function. It should be:
 *     ```
       wp_enqueue_script( 'custom-script', get_stylesheet_diretory() . '/js/file.js', array( 'jquery' ) );
       ```
   
 *  Thread Starter [codeguerilla](https://wordpress.org/support/users/codeguerilla/)
 * (@codeguerilla)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/problem-with-get_stylesheet_directory-using-child-theme/#post-4804736)
 * Sorry, that was actually a typo on my part here, Like I said I am currently using
   the full path and replaced it so you could see my non working code. The actual
   code does not have those characters.
 * Code is this:
 *     ```
       function add_required_scripts() {
          // register your script location and dependencies
          wp_register_script('bootstrap', get_stylesheet_directory() . '/wp-content/themes/twentyfourteen-child/js/bootstrap.min.js', array('jquery'));
          wp_register_script('flexslider',  '/wp-content/themes/twentyfourteen-child/jquery.flexslider-min.js', array('jquery'), '2.1');
          // enqueue the script
          wp_enqueue_script('bootstrap');
          wp_enqueue_script('flexslider');
       }
       add_action('wp_enqueue_scripts', 'add_required_scripts');
       ```
   
 * Still returning the broken file path of:
 * [http://localhost/clients/buysellmyhomelaC:xampphtdocsclientsmyclient/wp-content/themes/twentyfourteen-child/wp-content/themes/twentyfourteen-child/js/bootstrap.min.js?ver=3.8.2](http://localhost/clients/buysellmyhomelaC:xampphtdocsclientsmyclient/wp-content/themes/twentyfourteen-child/wp-content/themes/twentyfourteen-child/js/bootstrap.min.js?ver=3.8.2)
 *  Moderator [Jose Castaneda](https://wordpress.org/support/users/jcastaneda/)
 * (@jcastaneda)
 * THEME COFFEE MONKEY
 * [12 years, 2 months ago](https://wordpress.org/support/topic/problem-with-get_stylesheet_directory-using-child-theme/#post-4804912)
 * I think part of that reason is you are including the `/wp-content/themes/twentyfourteen-
   child`.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Problem with get_stylesheet_directory using child theme’ is closed to
new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 5 replies
 * 2 participants
 * Last reply from: [Jose Castaneda](https://wordpress.org/support/users/jcastaneda/)
 * Last activity: [12 years, 2 months ago](https://wordpress.org/support/topic/problem-with-get_stylesheet_directory-using-child-theme/#post-4804912)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
