I have a website that uses WordPress for its blog (the website itself is not WordPress). So the structure is:
www.website.com (not WordPress)
www.website.com/blog (WordPress)
I have a JavaScript file that is used for both the website and the blog. But when I link to the file in the functions.php file, WordPress tries to find it in the theme:
// Register the script
wp_register_script('circle-bounce', get_template_directory_uri() . '/js/general.js', array( 'jquery', 'jquery-effects-core', 'jquery-effects-bounce'));
This looks for the general.js file in the folder for the wordpress child theme. In the source, it links to:
http://www.website.com/blog/wp-content/themes/twentytwelve/js/general.js?ver=4.2.2
I actually need it to get the file inside the js folder in the root of the website. So the file can actually be found at:
website.com/js/general.js
The only way I’ve managed to achieve this is to change the registration to:
// Register the script
wp_register_script('circle-bounce', 'http://www.website.com/js/general.js', array( 'jquery', 'jquery-effects-core', 'jquery-effects-bounce'));
I’d like to avoid an absolute link if I can. Is there any other way?