Title: using wp_enqueue_script correctly
Last modified: August 20, 2016

---

# using wp_enqueue_script correctly

 *  Resolved [DesignLoud](https://wordpress.org/support/users/designloud/)
 * (@designloud)
 * [14 years ago](https://wordpress.org/support/topic/using-wp_enqueue_script-correctly/)
 * ok so yesterday I purchased a premium slider plugin and loaded it up and everything
   worked fine, then I went on to try to ‘properly’ insert my own js with the wp_enqueue_script
   method and although I got my own js to work, the slider has stopped working. 
   I contacted the author of the premium slider plugin and he says I am not properly
   using wp_enqueue_script and that is what is causing the conflict. When i look
   on wordpress for the documentation and forums for the wp_enqueue_script I dont
   fully understand how to pull this off. (Newbie with developing with wordpress
   but knowledgable in the old school static way) so below is what I have in the
   following files. Obviously this is not correct so could someone provide me an
   example of what I would do for this? (I’m better with seeing actual code with
   notes), it is as follows:
 * In my functions.php
 *     ```
       function my_bg_fade_script() {
       	wp_enqueue_script(
       		'jquery-fade',
       		get_template_directory_uri() . '/js/jquery.fade.js',
       		array('jquery')
       	);
       }
       add_action('wp_enqueue_scripts', 'my_bg_fade_script');
       ```
   
 *     ```
       function my_custom_bg_script() {
       	wp_enqueue_script(
       		'jquery-1-2-6-min',
       		get_template_directory_uri() . '/js/jquery-1.2.6.min.js',
       		array('jquery')
       	);
       }
       add_action('wp_enqueue_scripts', 'my_custom_bg_script');
       ```
   
 *     ```
       function my_custom_bg_script_2() {
       	wp_enqueue_script(
       		'jquery-bgpos',
       		get_template_directory_uri() . '/js/jquery.bgpos.js',
       		array('jquery')
       	);
       }
       add_action('wp_enqueue_scripts', 'my_custom_bg_script_2');
       ```
   
 * Then in my header.php is:
 *     ```
       <?php wp_enqueue_script("jquery"); ?>
   
       	<?php wp_head(); ?>
       ```
   
 * I have been working with this for two days now and spent entirely too much time
   on it, any help you can provide will be MUCH appreciated! Thanks
 * _[ Please do not bump, it’s [not permitted here](http://codex.wordpress.org/Forum_Welcome#No_Bumping).]_

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

 *  Thread Starter [DesignLoud](https://wordpress.org/support/users/designloud/)
 * (@designloud)
 * [14 years ago](https://wordpress.org/support/topic/using-wp_enqueue_script-correctly/#post-2800368)
 * Ok here is what the author of the plugin is telling me is the problem with my
   code, but hasnt offered any support on how to correct this:
 * He says
 * > This part adds second, old jquery incorrectly
 *     ```
       wp_register_script( 'jquery-1-2-6-min', get_template_directory_uri() . '/js/jquery-1.2.6.min.js', array('jquery') );
       wp_enqueue_script( 'jquery-1-2-6-min' );
       ```
   
 * Any suggestions on how to get this resolved?
 *  Thread Starter [DesignLoud](https://wordpress.org/support/users/designloud/)
 * (@designloud)
 * [14 years ago](https://wordpress.org/support/topic/using-wp_enqueue_script-correctly/#post-2800375)
 * Nevermind, simply had to remove that from my functions.php
 * thanks anyways

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

The topic ‘using wp_enqueue_script correctly’ is closed to new replies.

## Tags

 * [header.php](https://wordpress.org/support/topic-tag/header-php/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 1 participant
 * Last reply from: [DesignLoud](https://wordpress.org/support/users/designloud/)
 * Last activity: [14 years ago](https://wordpress.org/support/topic/using-wp_enqueue_script-correctly/#post-2800375)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
