Title: Where to put JavaScript Code
Last modified: August 30, 2016

---

# Where to put JavaScript Code

 *  Resolved [noosalucy](https://wordpress.org/support/users/noosalucy/)
 * (@noosalucy)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/where-to-put-javascript-code/)
 * I am an absolute newby and have no idea about code.
 * I am trying to use WP External Links Plugin.
    [](https://wordpress.org/plugins/wp-external-links/faq/)
 * I would like to have the external links on my site open in a popup browser window
   and this Plugin says I can do that but I need to add this Javascript code to 
   my site. I have no idea how or where to do that. The external links are located
   in my menu.
 * jQuery(function ($) {
 *  $(‘a[rel*=”external”]’).click(function (e) {
    // open link in popup window window.
   open($(this).attr(‘href’), ‘_blank’, ‘width=800, height=600’);
 *  // stop default and other behaviour
    e.preventDefault(); e.stopImmediatePropagation();});
 * });

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

 *  [paulwpxp](https://wordpress.org/support/users/paulwp/)
 * (@paulwp)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/where-to-put-javascript-code/#post-6250502)
 * Most WP themes already load jQuery in the front, so we can either hook our jQuery
   code to WP head or footer, it can be done in theme function which require making
   a child theme, or via a plugin like this one for example.
 * [https://wordpress.org/plugins/wp-custom-header-footer/](https://wordpress.org/plugins/wp-custom-header-footer/)
 *  Thread Starter [noosalucy](https://wordpress.org/support/users/noosalucy/)
 * (@noosalucy)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/where-to-put-javascript-code/#post-6250507)
 * Thank you so much paulwpxp! I looked into making a child theme but that was beyond
   me so I’m using the plugin you have suggested. So very easy to use and it is 
   all working just like I want it to.
 * thanks again.

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

The topic ‘Where to put JavaScript Code’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [noosalucy](https://wordpress.org/support/users/noosalucy/)
 * Last activity: [10 years, 10 months ago](https://wordpress.org/support/topic/where-to-put-javascript-code/#post-6250507)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
