Title: how to add wp_enqueue_script()
Last modified: August 20, 2016

---

# how to add wp_enqueue_script()

 *  [ibrar](https://wordpress.org/support/users/ibrar/)
 * (@ibrar)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/how-to-add-wp_enqueue_script/)
 * I want to use the wp_enqueue_script. Can someone help me out?
    I have to do is
   replaced the :
 * <script src=”<?php echo get_bloginfo(“template_url”); ?>/light/jquery.prettyPhoto.
   js” type=”text/javascript” charset=”utf-8″></script>
 * with
 * <?php wp_enqueue_script( ‘lightbox’ ); ?>
 * in the head of the header.php file before wp-head()?
 * Please check my method:
 * I applied wp_enqueue_script in function.php file
 * <?php
    function my_init_method() { wp_register_script( ‘lightbox’, ‘wp-content/
   themes/light/jquery.prettyPhoto.js’); wp_enqueue_script(‘lightbox’); } add_action(‘
   init’, ‘my_init_method’); ?>
 * Now calling this function from header.php like
 * <?php wp_enqueue_script(“lightbox”); ?>
 * but its create issue and stop all scripts working also…
 * Please help
 * Regards
    Ibrar

The topic ‘how to add wp_enqueue_script()’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [ibrar](https://wordpress.org/support/users/ibrar/)
 * Last activity: [13 years, 5 months ago](https://wordpress.org/support/topic/how-to-add-wp_enqueue_script/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
