Title: Manually* combine JavaScript
Last modified: August 22, 2016

---

# Manually* combine JavaScript

 *  [SamAshford](https://wordpress.org/support/users/samashford/)
 * (@samashford)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/manually-combine-javascript/)
 * Hi there,
 * I am running my installation on WP-ENGINE, they ban most of the useful plugins
   and the others for some reason don’t work. I am trying to speed up my site using
   the Google Insights guidelines. My site uses 18x .js files and the site takes
   ages to load.
 * I wanted to combine the .js files into 1 file which will nearly half the loading
   speed. Using the code below I have managed to disable ALL* .js files and the 
   page loads rapidly.
 * function my_deregister_javascript()
    { wp_deregister_script( ‘jquery’ ); wp_deregister_script(‘
   layerslider_js’ ); wp_deregister_script( ‘jquery_easing’ ); wp_deregister_script(‘
   transit’ ); wp_deregister_script( ‘layerslider_transitions’ ); wp_deregister_script(‘
   jquery.easing’ ); wp_deregister_script( ‘cookie’ ); wp_deregister_script( ‘jquery.
   slider’ ); wp_deregister_script( ‘efects’ ); wp_deregister_script( ‘modernizr.
   custom’ ); wp_deregister_script( ‘et_masonry’ ); wp_deregister_script( ‘flexslider’);
   wp_deregister_script( ‘superfish’ ); wp_deregister_script( ‘tooltip’ ); wp_deregister_script(‘
   tabs’ ); wp_deregister_script( ‘etheme’ ); wp_deregister_script( ‘wc-add-to-cart-
   variation’ ); } add_action( ‘wp_print_styles’, ‘my_deregister_javascript’, 101);
 * Next I created a new file called “custom.js”, I placed this into the js folder
   inside my theme. I copied ALL* the javascipt from the above files and placed 
   it inside the custom.js
 * I then called the js file with the following code
 * function etheme_enqueue_custom_styles()
    { wp_enqueue_script(‘jquery’, get_template_directory_uri().’/
   js/custom.js’); } add_action( ‘wp_enqueue_scripts’, ‘etheme_enqueue_custom_styles’);
 * The js file does load when you visit the website but nothing works. Its as if
   the the custom.js was empty the code inside it isn’t being used. Please help

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

 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [11 years, 8 months ago](https://wordpress.org/support/topic/manually-combine-javascript/#post-5216382)
 * var dump that path:
 *     ```
       var_dump(get_template_directory_uri().'/js/custom.js');
       ```
   
 * And make sure the file exists there
 *  Thread Starter [SamAshford](https://wordpress.org/support/users/samashford/)
 * (@samashford)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/manually-combine-javascript/#post-5216395)
 * I just tried that its definitely there, its there in the code and the link to
   it works.
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [11 years, 8 months ago](https://wordpress.org/support/topic/manually-combine-javascript/#post-5216403)
 * Where did you get this “etheme” from?
 *  Thread Starter [SamAshford](https://wordpress.org/support/users/samashford/)
 * (@samashford)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/manually-combine-javascript/#post-5216409)
 * ThemeForest I think, they are not very helpful
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [11 years, 8 months ago](https://wordpress.org/support/topic/manually-combine-javascript/#post-5216410)
 * Did this function already exist:
 *     ```
       function etheme_enqueue_custom_styles()
       ```
   
 *  Thread Starter [SamAshford](https://wordpress.org/support/users/samashford/)
 * (@samashford)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/manually-combine-javascript/#post-5216413)
 * Just to be sure I added <script src=”[http://timothyperkins.co.uk/wp-content/themes/blanco/js/custom.js”></script&gt](http://timothyperkins.co.uk/wp-content/themes/blanco/js/custom.js”></script&gt);
   in the head.
 * Its definitely in the script when the page loads just can’t understand what going
   wrong.

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

The topic ‘Manually* combine JavaScript’ is closed to new replies.

## Tags

 * [google insights](https://wordpress.org/support/topic-tag/google-insights/)
 * [javascript](https://wordpress.org/support/topic-tag/javascript/)
 * [js](https://wordpress.org/support/topic-tag/js/)
 * [performace](https://wordpress.org/support/topic-tag/performace/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 6 replies
 * 2 participants
 * Last reply from: [SamAshford](https://wordpress.org/support/users/samashford/)
 * Last activity: [11 years, 8 months ago](https://wordpress.org/support/topic/manually-combine-javascript/#post-5216413)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
