Child theme add custom js
Hello,
i created a child theme and i want to add a js file. For that I use the functions.php. Within the File I wrote the following part.
XXXXXX
function loadthescripts(){
wp_enqueue_script( 'script', get_template_directory_uri() . '/js/test.js', array ( 'jquery' ), 1.1, true);
}
/* ---------------------------------------------------------------------------
* Enqueue Style
* --------------------------------------------------------------------------- */
add_action( 'wp_enqueue_scripts', 'mfnch_enqueue_styles', 'loadthescripts' ,101 );
XXXXXXXXXXXXXXXXXXXXXX
In the test.js there is just a console.log Statement to test if the file is loaded....
Best wishes.
Andreas
While waiting for a response from one of our team members, we recommend to check Support Center where it is highly likely that you will find the answer to your question in no time.
FAQ | Video Tutorials | How to