I have avada theme, and I created child theme, how to add my custom js file in child theme.
I tried using this video tutorial, but without success https://www.youtube.com/watch?v=4xbvhXj72kU
Can you help me!
I have avada theme, and I created child theme, how to add my custom js file in child theme.
I tried using this video tutorial, but without success https://www.youtube.com/watch?v=4xbvhXj72kU
Can you help me!
You can use the wp_enqueue_script() function.
documentation: https://developer.wordpress.org/reference/functions/wp_enqueue_script/
This function allows you to load scripts at any given time.
Create a folder in child theme and upload your JS file to that folder.
You can include a js file using
wp_enqueue_script()
or you can use
<script src="<?php echo get_stylesheet_directory_uri(); ?>/js/filename.js" type="text/javascript"></script>
add the above code in theme header.php or footer.php