Answer the question
In order to leave comments, you need to log in
How to connect a new script to the footer in WordPress?
Hello! There is a script that needs to be displayed in the basement. According to Feng Shui, I know that I need to output scripts in the footer, but not directly in footer.php, but sort of through functions.js, but how to do it?
For example, I have an online form plugin, it requires the mandatory presence of this line in the template , that is, it is connected there. How can I include my script there? Thank you!
wp_footer();
Answer the question
In order to leave comments, you need to log in
function load_my_scripts() {
wp_enqueue_script('my-script-handline', 'ULR_TO_MY_JS_DIR' . 'my-script.js', array('jquery'), '', true);
}
add_action('wp_enqueue_scripts', 'load_my_scripts')
ULR_TO_MY_JS_DIR
the path to your script folder.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question