I am trying to install prebid.js to wordpress and I am still new to the whole structure of the wordpress installation. Is there any directory that I can safely upload to without breaking any dependencies or worrying about it being delete with an update?
1 Answer
You can create a child theme folder named yourTheme-child
in your theme's folder, and then upload your JavaScript files in that folder. (notice that yourTheme
is the name of your theme's folder)
You might also want to create a folder named js
inside that.
Take a look at : Child Themes
Child themes will not be deleted after updating your template/wordpress.
Then you can simply include your Js file in the header/footer this way:
<script type="text/javascript" src="Full URL Goes Here"></script>
or even better, enqueue your script it in the functions.php file using the below code:
function my_custom_script() {
wp_enqueue_script( 'my-custom-js', 'Full URL Goes Here', false );
}
add_action( 'wp_enqueue_scripts', 'my_custom_script' );