Recommended way to include a JavaScript file
-
Hi All,
Can anyone tell me the recommended method to include a new JavaScript file with the Responsive Child Theme?
I have done a Google and found about 9 different ways so I thought I would come straight to the horses mount and ask here.
The method I like the most is to add a functions.php to the child theme and put;-
<?php
function myJS_link() {
echo ‘<script language=”javascript” src=”JavaScriptFileName.js”>
</script>’ . “\n”;
}
add_action( ‘wp_head’, ‘myJS_link’ );Is that a good way of doing it?
Thanks heaps
Neil
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Recommended way to include a JavaScript file’ is closed to new replies.