Title: Custom Theme Javascript Not Working (Responsive-Select-Menu)
Last modified: August 24, 2016

---

# Custom Theme Javascript Not Working (Responsive-Select-Menu)

 *  [Nick](https://wordpress.org/support/users/nickmenster/)
 * (@nickmenster)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/custom-theme-javascript-not-working-responsive-select-menu/)
 * Hello,
 * I recently dove straight in to WordPress (was creating with Drupal) and had to
   convert an HTML/CSS website, to a WordPress theme.. Well, I managed to break 
   the site up into three sections (Index, Footer, Template page) so all would work.
   However, none of the JS that I try to add is working. I’ve managed to get it 
   where I can use a plugin for the menu, but need JS to make it link to other pages!
 * I can’t publicly post the URL, as it’s for work, however, if we can private message
   or anything of that sort on the forum, or email, I’ll happily share the URL, 
   just can’t publicly.
 * I’m not sure what to put in the functions.php or what-not to set up javascript
   correctly, so that may be my issue. Kind of a rough way to jump into WordPress,
   but the more I learn the better!
 * Thanks!

Viewing 15 replies - 1 through 15 (of 20 total)

1 [2](https://wordpress.org/support/topic/custom-theme-javascript-not-working-responsive-select-menu/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/custom-theme-javascript-not-working-responsive-select-menu/page/2/?output_format=md)

 *  [Ismail](https://wordpress.org/support/users/elhardoum/)
 * (@elhardoum)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/custom-theme-javascript-not-working-responsive-select-menu/#post-6067059)
 *     ```
       add_action( 'wp_enqueue_scripts', 'enqueue_my_script' );
   
       function enqueue_my_script() {
   
           wp_register_script( 'my-script', '//yoursite.com/js/code.js' );
           wp_enqueue_script('my-script');
   
       }
       ```
   
 * Use `wp_register_script` & `wp_enqueue_script` to enqueue the scripts the right
   way.
 *  Thread Starter [Nick](https://wordpress.org/support/users/nickmenster/)
 * (@nickmenster)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/custom-theme-javascript-not-working-responsive-select-menu/#post-6067072)
 * Thank you very much for the reply Samuel!
 * With the wp_register_script & wp_enqueue_script, would I do it like the following?
 *     ```
       add_action( 'wp_enqueue_scripts', 'enqueue_my_script' );
   
       function enqueue_my_script() {
   
           wp_register_script( 'my-script', 'URL/wp-content/plugins/responsive-select-menu/sparkoptions/sparkoptions.js' );
           wp_enqueue_script('my-script');
       ```
   
 * I did that in the functions.php, I’m not quite familiar with WordPress (not creating
   themes from scratch anyways. The JS isn’t working after doing that, so I suppose
   something isn’t set up correctly.
 * Again, thank you very much! Trying to do this the best I can, just not familiar
   with WordPress yet!
 *  [Ismail](https://wordpress.org/support/users/elhardoum/)
 * (@elhardoum)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/custom-theme-javascript-not-working-responsive-select-menu/#post-6067078)
 * You’re welcome.
 * By the way, you’re missing an `}` in the above code. if the script is Jquery 
   don’t forget to enqueue as well `//ajax.googleapis.com/ajax/libs/jquery/1.11.1/
   jquery.min.js` if not enqueued in the page already by other plugins, better do
   it.
 * check out this answer: [http://wordpress.stackexchange.com/q/185579/#answer-185585](http://wordpress.stackexchange.com/q/185579/#answer-185585)
 * Don’t forget to let us know what isn’t working in case it didn’t work..
 *  Thread Starter [Nick](https://wordpress.org/support/users/nickmenster/)
 * (@nickmenster)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/custom-theme-javascript-not-working-responsive-select-menu/#post-6067248)
 * Thank you again for the help!
 * When I added the code for the jquery, the entire page went white. I went to the
   page you linked to, and tried that, and the page was still white..
 * With the code I showed above (I forgot to copy the }) it still doesn’t make the
   plugin work, it’ll show up, but the javascript won’t work.
 * Am I missing something in particular?
 * Thanks again!
 *  [Ismail](https://wordpress.org/support/users/elhardoum/)
 * (@elhardoum)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/custom-theme-javascript-not-working-responsive-select-menu/#post-6067254)
 * Hi Nick!
 * Actually I have no idea what is not working for you, maybe you should provide
   a link to your site, or look through the source code to see if scripts are enqueued,
   etc..
 * Explaining more will help others understand your issue.
 * Thank you!
 *  Thread Starter [Nick](https://wordpress.org/support/users/nickmenster/)
 * (@nickmenster)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/custom-theme-javascript-not-working-responsive-select-menu/#post-6067289)
 * Hi Samuel!
 * As I explained in the thread, I can’t publicly post the URL, as it’s for work.
   If there is a way I can send it to you directly, I can do that.
 * The menu (Responsive-select-menu) will show up, but none of the links are clickable.
   They are supposed to be targeted by JavaScript, which will take you to the URLs.
 * This is the code I put into functions.php on the theme I created.
 *     ```
       <?php
       add_action( 'wp_enqueue_scripts', 'responsive-select-menu' );
   
       function enqueue_my_script() {
   
           wp_register_script( 'responsive-select-menu', '//fineframegallery.com/wp-content/plugins/responsive-select-menu/sparkoptions/sparkoptions.js' );
           wp_enqueue_script('my-script');
   
       }
       ?>
       ```
   
 * I have tried changing my-script to the plugin name, however, it just makes the
   page white, with no source code whats-so-ever.
 *  Thread Starter [Nick](https://wordpress.org/support/users/nickmenster/)
 * (@nickmenster)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/custom-theme-javascript-not-working-responsive-select-menu/#post-6067308)
 * Just tried the following things as well, but with no working luck.
 *     ```
       <?php
       wp_register_script( $handle, $src, $deps, $ver, $in_footer );
       wp_enqueue_script( $handle, $src, $deps, $ver, $in_footer );
       ?>
   
       <?php
   
       function wptuts_scripts_with_the_lot()
       {
           // Register the script like this for a plugin:
           wp_register_script( 'responsive-select-menu', plugins_url( '/sparkoptions/sparkoptions.js', __FILE__ ), array( 'jquery', 'jquery-ui-core' ), '20120208', true );
           // or
           // Register the script like this for a theme:
           wp_register_script( 'responsive-select-menu', get_template_directory_uri() . '/sparkoptions/sparkoptions.js', array( 'jquery', 'jquery-ui-core' ), '20120208', true );
   
           // For either a plugin or a theme, you can then enqueue the script:
           wp_enqueue_script( responsive-select-menu );
       }
       add_action( 'wp_enqueue_scripts', 'wptuts_scripts_with_the_lot' );
   
       ?>
       ```
   
 * Not quite sure what to do now, any help would be amazing. 🙂
 *  [Ismail](https://wordpress.org/support/users/elhardoum/)
 * (@elhardoum)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/custom-theme-javascript-not-working-responsive-select-menu/#post-6067311)
 * Hi Nick.
 * sorry for the delay. I tried to access your JS direct link ( `fineframegallery.
   com/wp-content/plugins/responsive-select-menu/sparkoptions/sparkoptions.js` )
   but it returned a 404 web page. Are you trying to enqueue the right ones ?
 * Anyways, why are you trying to enqueue the scripts for such a popular plugin ?
   I know if you activate the plugin it should do everything..
 * This code should work, if you put it in the plugin file :
 *     ```
       add_action('admin_enqueue_scripts', 'enqueue_my_script');
   
       function enqueue_my_script() {
       		wp_register_script('responsive-select-menu', plugin_dir_url( __FILE__ ) . '/sparkoptions/sparkoptions.js', array('jquery'));
       		wp_enqueue_script('responsive-select-menu');
       }
       ```
   
 * or give a direct link ( `fineframegallery.com/wp-content/plugins/responsive-select-
   menu/sparkoptions/sparkoptions.js` ) if you put the code in functions.php file..
 * Is this your website ? fineframegallery.com
 * Regards.
 *  Thread Starter [Nick](https://wordpress.org/support/users/nickmenster/)
 * (@nickmenster)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/custom-theme-javascript-not-working-responsive-select-menu/#post-6067322)
 * Hi Samuel,
 * That’s not the right URL, (not my website) but I have a similar code in the functions.
   php. When I go to the URL I have enque’d, I see the code.
 * Like I said, none of the Javascript works on the site, so just activating the
   plugin doesn’t work, it’ll show up, yet not go to any page.
 * Where in the plugin file do I put that exactly? In the actual JS for that file?
 *  [Ismail](https://wordpress.org/support/users/elhardoum/)
 * (@elhardoum)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/custom-theme-javascript-not-working-responsive-select-menu/#post-6067323)
 * Sorry Nick I used `admin_enqueue_scripts` which enqueues scripts in the admin
   page, tough we should be more specific to enqueue them in the plugin page only.
 * You don’t need to edit the plugin to add that, because adding this in your functions.
   php will do the job ONLY if the slug of the plugin is `responsive-select-menu`
   and the plugin is activated:
 *     ```
       add_action( 'wp_enqueue_scripts', 'enqueue_my_script' );
   
       function enqueue_my_script() {
   
           wp_register_script( 'my-script', esc_url( home_url( '/' ) ) .'wp-content/plugins/responsive-select-menu/sparkoptions/sparkoptions.js', array('jquery') );
           wp_enqueue_script('my-script');
   
       }
       ```
   
 * You can access the plugin JS file directly here [http://yoursite.com/wp-content/plugins/responsive-select-menu/sparkoptions/sparkoptions.js](http://yoursite.com/wp-content/plugins/responsive-select-menu/sparkoptions/sparkoptions.js)
 * Please post your support questions in the official plugin support forum here 
   on wp.org forums: [http://wordpress.org/support/plugin/responsive-select-menu](http://wordpress.org/support/plugin/responsive-select-menu)
 *  Thread Starter [Nick](https://wordpress.org/support/users/nickmenster/)
 * (@nickmenster)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/custom-theme-javascript-not-working-responsive-select-menu/#post-6067324)
 * Samuel,
 * I would post in the official plugin support, however, this isn’t the only plugin
   that won’t work right.. It’s like my theme isn’t set up for Javascript correctly.
 * No plugin that requires Javascript or anything of that sort will work.. I had
   to convert the theme from HTML/CSS to work with WordPress, so I’m sure I didn’t
   set up some necessary component.
 * Thank you again for the assistance.
 *  [Ismail](https://wordpress.org/support/users/elhardoum/)
 * (@elhardoum)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/custom-theme-javascript-not-working-responsive-select-menu/#post-6067325)
 * Well, if that’s the case, you need to worry more about the theme you are developing.
   here’s your guide:
 * [Theme Development – Codex](https://codex.wordpress.org/Theme_Development)
 * Because in WP all you need to do is install and activate the plugin, and it is
   going to do everything automatically. seems like your theme isn’t set up correctly
   yet.
 * if you switch to another default theme, you’ll notice that the plugin is going
   to work.
 * You have to work more on the theme you are converting. because WP themeing is
   something more than CSS/HTML..
 * 🙂
 *  Thread Starter [Nick](https://wordpress.org/support/users/nickmenster/)
 * (@nickmenster)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/custom-theme-javascript-not-working-responsive-select-menu/#post-6067326)
 * Samuel,
 * By chance, could you assist me with setting up some “hidden” things? I looked
   at the page linked, but only thing in reference to JavaScript was to be in CDATA
   to help with older browsers.
 * I’ve been stuck with this website for over a week.. The menu is quite important.
 * Could you email me so we can discuss more in-depth with URL’s? _[Moderated]_
 * Thanks! 🙂
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [10 years, 11 months ago](https://wordpress.org/support/topic/custom-theme-javascript-not-working-responsive-select-menu/#post-6067327)
 * It’s really nice that Samuel has taken the time to help you out, what a great
   guy 🙂 Though he’s really doing it out of the kindness of his heart – and that
   can run out if it’s pushed too far by asking for more than he signed up. Let’s
   continue this on the forums.
 *  Thread Starter [Nick](https://wordpress.org/support/users/nickmenster/)
 * (@nickmenster)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/custom-theme-javascript-not-working-responsive-select-menu/#post-6067328)
 * Alright, sorry about that Andrew.
 * I just can’t release the website URL publicly on the forum, and that’s something
   that will be needed to help set up something like this. :L
 * What in particular relates from a page to the javascript function of WordPress?
   Is there a certain page that is supposed to contain a code, or something of that
   nature?

Viewing 15 replies - 1 through 15 (of 20 total)

1 [2](https://wordpress.org/support/topic/custom-theme-javascript-not-working-responsive-select-menu/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/custom-theme-javascript-not-working-responsive-select-menu/page/2/?output_format=md)

The topic ‘Custom Theme Javascript Not Working (Responsive-Select-Menu)’ is closed
to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 20 replies
 * 4 participants
 * Last reply from: [Vickymedia](https://wordpress.org/support/users/vickymedia/)
 * Last activity: [10 years, 8 months ago](https://wordpress.org/support/topic/custom-theme-javascript-not-working-responsive-select-menu/page/2/#post-6067443)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
