So I'm trying to put some javascript into my functions.php and run it from there but everytime I do that I get an error on my page when site is reloaded...
"Parse error: syntax error, unexpected 'wp_enqueue_script' (T_STRING) Local Sites\custom-site\app\public\wp-content\themes\theme\functions.php on line 35"
Here is the code, and yes I did put wp_footer in my footer.php file to run it...
function addjs() {
wp_register_script('jquery', get_template_directory_uri() . '/plugin-frameworks/jquery-3.2.1.min.js', array() , 1, 1, 1)
wp_enqueue_script('jquery');
wp_register_script('bootstrap', get_template_directory_uri() . '/plugin-frameworks/bootstrap.min.js', array() , 1, 1, 1)
wp_enqueue_script('bootstrap');
wp_register_script('swiper', get_template_directory_uri() . '/plugin-frameworks/swiper.js', array() , 1, 1, 1)
wp_enqueue_script('swiper');
wp_register_script('scripts', get_template_directory_uri() . '/common/scripts.js', array() , 1, 1, 1)
wp_enqueue_script('scripts');
wp_register_script('custom', get_template_directory_uri() . '/custom.js', array() , 1, 1, 1)
wp_enqueue_script('custom');
}
add_action('wp_enqueue_script', 'addjs', 999);
I really don't know what I'm doing wrong here... Thanks in advance :)