Title: Custom theme JavaScript not working
Last modified: August 21, 2016

---

# Custom theme JavaScript not working

 *  Resolved [sorenkalla](https://wordpress.org/support/users/sorenkalla/)
 * (@sorenkalla)
 * [12 years ago](https://wordpress.org/support/topic/custom-theme-javascript-not-working/)
 * I am attempting to design my own wordpress theme, but I’m having issues getting
   my JavaScript to work, and nothing I have researched seems to have the answer.
   If anyone can help me out I’d greatly appreciate it!
 * Things I have done:
 * Enqueue my javascript file in functions.php:
 *     ```
       function sorenTheme_scripts() {
           wp_enqueue_style('style', get_stylesheet_uri());
           wp_register_script( 'soren-script', get_template_directory_uri() . '/js/soren-script.js', array( 'jquery', 'jquery-ui-core' ), '1', true );
           wp_enqueue_script('soren-script');
       }
       add_action('wp_enqueue_scripts', 'sorenTheme_scripts');
       ```
   
 * Create a simple javaScript file in the directory {template folder}/js named soren-
   script.js, which currently just contains a very simple alert test
 * `alert('Hello World');`
 * and that’s it. When I tried to put the alert in the index.php file directly using
   the script tags, the alert came up as expected, but when I move it to the js 
   file I get nothing. Is there something i need to add to the .php or .js files?

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

 *  [stephencottontail](https://wordpress.org/support/users/stephencottontail/)
 * (@stephencottontail)
 * [12 years ago](https://wordpress.org/support/topic/custom-theme-javascript-not-working/#post-4933903)
 * Shot in the dark, but are you remembering to call [`wp_footer()`](http://codex.wordpress.org/Plugin_API/Action_Reference/wp_footer)
   in your theme? Because you put `true` for the final argument to `wp_register_script()`,
   WordPress will load the script at the bottom of the `<body>` tag, but you need
   to call `wp_footer()` for that to work.
 *  [eco7eco](https://wordpress.org/support/users/eco7eco/)
 * (@eco7eco)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/custom-theme-javascript-not-working/#post-4934248)
 * Thank you x1,000,000, [@stephencottontail](https://wordpress.org/support/users/stephencottontail/)!
   I was tearing my hair out trying to figure out why pretty much anything related
   to jQuery wouldn’t work on my extremely stripped down custom theme, which I made
   to embed elsewhere. I recklessly removed the footer thinking that I wouldn’t 
   need it.
 * This has been plaguing me for hours. After reading dozens of blog posts and help
   articles, I stumbled upon your comment. I restored get_footer(), and all is right
   again in my little corner of the world!

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

The topic ‘Custom theme JavaScript not working’ is closed to new replies.

## Tags

 * [custom](https://wordpress.org/support/topic-tag/custom/)
 * [javascript](https://wordpress.org/support/topic-tag/javascript/)
 * [Javascript not loading](https://wordpress.org/support/topic-tag/javascript-not-loading/)
 * [loading](https://wordpress.org/support/topic-tag/loading/)
 * [not](https://wordpress.org/support/topic-tag/not/)
 * [php](https://wordpress.org/support/topic-tag/php/)
 * [working](https://wordpress.org/support/topic-tag/working/)

 * 2 replies
 * 3 participants
 * Last reply from: [eco7eco](https://wordpress.org/support/users/eco7eco/)
 * Last activity: [11 years, 2 months ago](https://wordpress.org/support/topic/custom-theme-javascript-not-working/#post-4934248)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
