Title: Help with wp_enqueue
Last modified: August 20, 2016

---

# Help with wp_enqueue

 *  Resolved [vikkineal](https://wordpress.org/support/users/vikkineal/)
 * (@vikkineal)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/help-with-wp_enqueue/)
 * Hi
 * I’m trying to add supersized via wp_enqueue and only on certain pages – but without
   much luck.
 * I’ve currently got the query in the footer with the following PHP – THIS WORKS..
 *     ```
       <?php if ( !( is_page_template('modelPages.php') || is_archive() || is_single() || is_page_template('contactUsTemplate.php') ) ) { ?>
       <script type="text/javascript" src="<?php echo bloginfo('template_directory');?>/scripts/supersized.3.2.7.min.js"></script>
       <script type="text/javascript" src="<?php echo bloginfo('template_directory');?>/theme/supersized.shutter.min.js"></script>
       <?php } ?>
       ```
   
 * However, trying to port that over to my functions file seems to just break super
   sized full stop…
 *     ```
       function custom_scripts() {
       	if ( !is_admin() ) {
       	wp_deregister_script('jquery');
       	wp_register_script('jquery', ("https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"), false);
       	wp_enqueue_script('jquery');
       }
       if( is_page( 'home' ) ) :
       	wp_enqueue_script(
       	'jcarousel',
       	get_template_directory_uri() . '/scripts/jquery.jcarousel.min.js',
       	array( 'jquery' ),
       	null,
       	true
       );
       elseif( is_single() ) :
       	wp_enqueue_script(
       	'slimbox',
       	get_template_directory_uri() . '/scripts/slimbox2.js',
       	array( 'jquery' ),
       	null,
       	true
       );
       elseif( !(is_page_template('modelPages.php') || is_archive() || is_single() || is_page_template('contactUsTemplate.php')  )  ) :
           // SUPERSIZED SHOULD GO HERE BUT BREAKS
       endif;
       }    
   
       add_action( 'wp_enqueue_scripts', 'custom_scripts' );
       ```
   
 * It just doesn’t load it at all – not even if i add it to the home rule.
 * Can someone please advise on what I’m doing wrong? I clearly am getting in a 
   muddle about adding multiple enqueues to a rule…

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

 *  Thread Starter [vikkineal](https://wordpress.org/support/users/vikkineal/)
 * (@vikkineal)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/help-with-wp_enqueue/#post-2957340)
 * I’m now wondering whether i need to register the script?
 *  Thread Starter [vikkineal](https://wordpress.org/support/users/vikkineal/)
 * (@vikkineal)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/help-with-wp_enqueue/#post-2957344)
 * Ok – so registering the script makes it load on the page HOWEVER I’m getting 
   the following error…
 * Error: TypeError: api is undefined
 * and the images aren’t loading…
 *  Thread Starter [vikkineal](https://wordpress.org/support/users/vikkineal/)
 * (@vikkineal)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/help-with-wp_enqueue/#post-2957353)
 * Figured it out – my function were loading before the wp_enqueue had been called
   so was throwing an error.
 * Swapped the order round and it’s now fine!

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

The topic ‘Help with wp_enqueue’ is closed to new replies.

## Tags

 * [supersized](https://wordpress.org/support/topic-tag/supersized/)
 * [wp_enqueue](https://wordpress.org/support/topic-tag/wp_enqueue/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 1 participant
 * Last reply from: [vikkineal](https://wordpress.org/support/users/vikkineal/)
 * Last activity: [13 years, 8 months ago](https://wordpress.org/support/topic/help-with-wp_enqueue/#post-2957353)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
