Title: Get my Javascript On!
Last modified: August 20, 2016

---

# Get my Javascript On!

 *  [cicakchanson](https://wordpress.org/support/users/cicakchanson/)
 * (@cicakchanson)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/get-my-javascript-on/)
 * Hello, I am new to javascript so I’m sure this question is going to be a snap
   so thanks for your help. I’m trying to call up a javascript file that I’ve created
   in order to get an accordion menu on my site working. I have successfully gotten
   it to work by placing the following code in the “header.”
 *     ```
       <script src="<?php bloginfo( 'template_directory' ); ?>/javascripts/jquery.js" language="javascript" type="text/javascript"></script>
          <script src="<?php bloginfo( 'template_directory' ); ?>/javascripts/scripts.js" language="javascript" type="text/javascript"></script>
       ```
   
 * Now I do know that this is not the right way to call up scripts since it can 
   result in jquery conflicts so I’d really like to use the wp_enqueue_script method.
   So far I’ve come up with the following code
 *     ```
       <?php
       wp_register_script(
           'scripts',
           '/javascripts/scripts.js',
           array('jquery'),
           false,
           false
       );
       wp_enqueue_script('scripts');
   
       ?>
       ```
   
 * So the issue with the code I’ve written is that I get an error with Chrome’s 
   inspector that says “GET [http://www.thewanderingguru.com/m2world/javascripts/scripts.js?ver=1](http://www.thewanderingguru.com/m2world/javascripts/scripts.js?ver=1)
   404 (Not Found)”
 * I’m unsure what to make of this since there isn’t a “version” of this file. I
   created it from code I got on the net [HERE](http://matthewaprice.com/simple-wordpress-accordion-menu/)
 * Thanks for any help you can offer

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

 *  [varkeychaya](https://wordpress.org/support/users/varkeychaya/)
 * (@varkeychaya)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/get-my-javascript-on/#post-3548421)
 * in the code above you have mentioned the php function bloginfo( ‘template_directory’)
   but not while using the enqueue below
 *  Thread Starter [cicakchanson](https://wordpress.org/support/users/cicakchanson/)
 * (@cicakchanson)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/get-my-javascript-on/#post-3548456)
 * Thanks for the help. Admittedly I’m very new at PHP and Javascript. I have found
   other sites that explain how to do this but I still can’t quite get it to work.
   How would I call the template directory in the enqueue? Thanks for the help.

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

The topic ‘Get my Javascript On!’ is closed to new replies.

## Tags

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

 * 2 replies
 * 2 participants
 * Last reply from: [cicakchanson](https://wordpress.org/support/users/cicakchanson/)
 * Last activity: [13 years, 3 months ago](https://wordpress.org/support/topic/get-my-javascript-on/#post-3548456)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
