Title: Trouble with wp_enqueue_script
Last modified: September 1, 2016

---

# Trouble with wp_enqueue_script

 *  [learntodesign](https://wordpress.org/support/users/learntodesign/)
 * (@learntodesign)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/trouble-with-wp_enqueue_script/)
 * Hello, I am trying to add the jquery cycle plugin ([http://jquery.malsup.com/cycle/](http://jquery.malsup.com/cycle/))
   to my wordpress site.
    I downloaded the jquery.cycle.all.js file and put in in
   my child theme (lets call it TestChild) in the directory like so TestChild/assets/
   scripts/jquery.cycle.all.js
 * In my functions.php of my child theme I then proceeded to insert this:
 *     ```
       //Add Cycle
       add_action ('wp_enqueue_script', 'theme_add_cycle_slide' );
       function theme_add_cycle_slide (){
          wp_enqueue_script('jquery');
          wp_enqueue_script('cycleall', get_stylesheet_directory_uri() . '/assets/scripts/jquery.cycle.all.js');
       }
       ```
   
 * In my body I have the following:
 *     ```
       <div id="slideshow">
         <div style="width:250px; height:150px; background:red;"></div>
         <div style="width:250px; height:150px; background:blue;"></div>
         <div style="width:250px; height:150px; background:green;"></div>
         <div style="width:250px; height:150px; background:yellow;">
         </div>
         <div id="prev" style="float:left;">PREV</div>
         <div id="next" style="float:right;">NEXT</div>
       ```
   
 * In my footer, just before the </body> tag I have the javascript function:
 *     ```
       <!-- Slideshow -->
        <script language="javascript">
       jQuery(document).ready(function($) {
        $('#slideshow').cycle({
           fx:    'fade',
           pause:  1
         });
       });
       </script>
       ```
   
 * When I load the site, I get a console error:
    Uncaught TypeError: $(…).cycle 
   is not a function
 * When I load the source, the script is not present. I don’t understand what I 
   am doing incorrectly. I would appreciate any help as this has been causing me
   hours of frustration.
    _ [moderated to add “code” blocks]

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

 *  [stephencottontail](https://wordpress.org/support/users/stephencottontail/)
 * (@stephencottontail)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/trouble-with-wp_enqueue_script/#post-7503821)
 * Looks like you’ve got an error in your very first code block. It should be `wp_enqueue_scripts`(
   plural):
 *     ```
       add_action ('wp_enqueue_scripts', 'theme_add_cycle_slide' );
       function theme_add_cycle_slide (){
         ...code snipped for clarity...
       }
       ```
   
 *  Moderator [t-p](https://wordpress.org/support/users/t-p/)
 * (@t-p)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/trouble-with-wp_enqueue_script/#post-7503828)
 * useful tutorial:
    [http://www.wpbeginner.com/wp-tutorials/how-to-properly-add-javascripts-and-styles-in-wordpress/](http://www.wpbeginner.com/wp-tutorials/how-to-properly-add-javascripts-and-styles-in-wordpress/)
 *  Thread Starter [learntodesign](https://wordpress.org/support/users/learntodesign/)
 * (@learntodesign)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/trouble-with-wp_enqueue_script/#post-7503832)
 * Thank you. I finally realized that.

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

The topic ‘Trouble with wp_enqueue_script’ is closed to new replies.

## Tags

 * [javascript](https://wordpress.org/support/topic-tag/javascript/)
 * [wp_enqueue_script](https://wordpress.org/support/topic-tag/wp_enqueue_script/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 3 participants
 * Last reply from: [learntodesign](https://wordpress.org/support/users/learntodesign/)
 * Last activity: [9 years, 11 months ago](https://wordpress.org/support/topic/trouble-with-wp_enqueue_script/#post-7503832)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
